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 potential segfaults when adding breadcrumb with NDK #546

Merged
merged 8 commits into from
Aug 1, 2019

Conversation

fractalwrench
Copy link
Contributor

Goal

We have noticed infrequent crashes when adding a breadcrumb and NDK error detection is enabled. This changeset fixes some potential causes of this behaviour.

Changeset

  • Made Breadcrumb immutable by taking a defensive copy of the map parameter, and returning a decorated Collection from the getter that is unmodifiable.
  • Corrected sizeof calculation when iterating through breadcrumb metadata
  • Added null check for metadata and metadata keys in breadcrumbs

Tests

  • Added unit tests to verify Breadcrumb metadata immutability
  • Tested leaving breadcrumbs with metadata in example app

Copy link
Contributor

@kattrali kattrali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, added a style nit.

bugsnag-plugin-android-ndk/src/main/jni/metadata.c Outdated Show resolved Hide resolved
bugsnag-plugin-android-ndk/src/main/jni/metadata.c Outdated Show resolved Hide resolved
Co-Authored-By: Delisa <kattrali@users.noreply.github.com>
@fractalwrench fractalwrench merged commit 21859fe into master Aug 1, 2019
@fractalwrench fractalwrench deleted the fix-breadcrumb-segfault branch August 1, 2019 08:31
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.

2 participants