Fraunhofer-IIS / libjapi

libjapi is a universal JSON to C API library. It receives newline-delimited JSON (NDJSON) messages via TCP and calls registered C functions. A JSON response is returned for each request. Furthermore, it is also possible to create push services, which asynchronously push JSON messages to the clients subscribed to them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resolve "japi_context is used after a free() call" - [merged]

fraunhofer-iis-bot opened this issue · comments

In GitLab by @fraunhofer-iis-anon on Mar 2, 2020, 17:29

Merges 29-japi_context-is-used-after-a-free-call -> master

Closes #29

In GitLab by @fraunhofer-iis-anon on Mar 2, 2020, 18:42

added 1 commit

  • 2ca880b - move free() call to end of function

Compare with previous version

In GitLab by @fraunhofer-iis-anon on Mar 2, 2020, 18:44

unmarked as a Work In Progress

In GitLab by @jannismain on Mar 3, 2020, 10:49

When you go the extra mile to find a test that shows that (a) a bug existed and (b) it doesn't exist anymore after your change (which I know you did 🙂 ), feel free to add it here (and, even better, to the test suite) so others see at first glance that it got fixed without having to verify it manually.

For context, he used gcc's sanitizers in combination with the gtest suite to show the use_after_free bug programmatically:

Image_Pasted_at_2020-3-2_18-29

I think the sanitizers should be used during testing to prevent bugs of this nature in the future.

In GitLab by @cstender on Mar 3, 2020, 11:55

Thanks for the bugfix!

In GitLab by @cstender on Mar 3, 2020, 11:55

mentioned in commit 412754e

In GitLab by @cstender on Mar 3, 2020, 11:55

merged