Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(recording): address unterminated string in thread gathering logic #720

Merged
merged 2 commits into from
Jun 26, 2020

Conversation

tomlongridge
Copy link
Contributor

Goal

Fixes #719 in gathering thread data for handled errors - the initial memory allocation was incorrectly proceeded by a strlen call with no initial terminator added.

Changeset

Changed the bsg_kscrw_i_resetThreadTraceData function from memseting all the data to just null-terminating at 0, which is sufficient for our needs.

Also re-worked the logic slightly to encapsulate all the memory management (including initial malloc) in bsg_kscrw_i_collectJsonData and also guarded against malloc failing.

Tests

Ran the example app with Malloc Scribble, Malloc Guard Edges and Guard Malloc enabled.

Also manually tested returning BSG_KSJSON_ERROR_CANNOT_ADD_DATA from bsg_kscrw_i_collectJsonData to ensure that the error was still delivered.

@tomlongridge tomlongridge merged commit 52c0eed into master Jun 26, 2020
@tomlongridge tomlongridge deleted the tom/handled-thread-trace-bad-access branch June 26, 2020 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when logging an error in bugsag 6.0 using Malloc Scribble, Malloc Guard Edges and Guard Malloc
2 participants