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: Fix Dereferenced Garbage Pointer #148

Merged

Conversation

BrandonStalnaker
Copy link
Contributor

@BrandonStalnaker BrandonStalnaker commented May 3, 2022

Summary

A pattern was being used where a static NSString is converted to a std::string via the UTF8String property of NSString, stored in a std::vector, and then retrieved via operator[]. This result is then copied into a new string at the call site, which is where the app crashes.

Master Issue

Closes https://mparticle-eng.atlassian.net/browse/SQDSDKS-3658?atlOrigin=eyJpIjoiY2Q0NmJiNTY1NzAyNGE0MzgxM2RmZGE0MjI4MzViMTciLCJwIjoiaiJ9

@einsteinx2
Copy link
Contributor

I'm going to give this a deeper look later, am slammed rest of today.

@BrandonStalnaker BrandonStalnaker force-pushed the fix/3658-fix-Dereferenced-Garbage-Pointer branch from 771e5ba to 2b19e62 Compare May 5, 2022 16:22
@BrandonStalnaker BrandonStalnaker force-pushed the fix/3658-fix-Dereferenced-Garbage-Pointer branch from 2b19e62 to ed957b1 Compare May 5, 2022 16:29
Copy link
Contributor

@einsteinx2 einsteinx2 left a comment

Choose a reason for hiding this comment

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

Changes look great, so nice to see how much cleaner the code is without all that unnecessary C++. Since we're not longer doing the thing that was causing the crash, hopefully this takes care of it.

I was going to spend some time and do some more C++ refactoring, but honestly I have no spare time right now, so I'll go ahead and approve this since that's really unrelated anyway.

@BrandonStalnaker BrandonStalnaker merged commit 8374c1e into development May 12, 2022
@BrandonStalnaker BrandonStalnaker deleted the fix/3658-fix-Dereferenced-Garbage-Pointer branch May 12, 2022 18:27
mparticle-automation added a commit that referenced this pull request May 17, 2022
# [8.8.0](v8.7.0...v8.8.0) (2022-05-17)

### Bug Fixes

* Fix Dereferenced Garbage Pointer ([#148](#148)) ([d2c58e1](d2c58e1))
* property memory annotations ([#146](#146)) ([c95ddf6](c95ddf6))
* update active kits header ([#147](#147)) ([d196723](d196723))

### Features

* add conformsToProtocol forwarding to MPAppDelegateProxy ([#144](#144)) ([40e517a](40e517a))
* add support for client side rules ([#151](#151)) ([6a93096](6a93096))
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