Fix Crashlytics abort on binary image records with a non-numeric base or size - #16547
Fix Crashlytics abort on binary image records with a non-numeric base or size#16547JayPatel095 wants to merge 3 commits into
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request fixes a crash in FIRCLSSymbolResolver when processing binary image records with non-numeric base or size values by ensuring they are instances of NSNumber. It also adds a corresponding unit test and test data. The feedback suggests extracting the base and size dictionary lookups into local variables to avoid redundant lookups and improve readability.
a5b3602 to
8f91bf4
Compare
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
8f91bf4 to
9455f4e
Compare
|
Attempt number 3! |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request fixes a crash in FIRCLSSymbolResolver when processing binary image records with non-numeric base or size values (such as strings) by ensuring they are instances of NSNumber. It also adds a unit test and corresponding test data to verify this behavior. The feedback suggests strengthening the new unit test by asserting that the invalid entry is skipped and valid entries are successfully loaded, rather than just verifying that the load method succeeds without crashing.
Discussion
Fixes #16519.
FIRCLSSymbolResolverdrops binary image records whosebase/sizeare missing orNSNull, then sorts with[base1 compare:base2]without checkingbaseis a number. If its a stringNSNumbersendsobjCTypeto it and the process dies with an uncaughtNSInvalidArgumentException. This happens on Crashlytics'queue while processing a report at launch, so an app doesn't catch it, and Crashlytics reports its own abort as an application crash.This replaces both checks with a single
isKindOfClass:[NSNumber class]test onbaseandsize. It covers the old cases ([nil isKindOfClass:]isNO;NSNullis not anNSNumber) and also rejects strings, arrays, and dictionaries, which abort the comparator the same way. A stringsizeis dropped too, it passes the current fliter but crashes later inloadedBinaryImageForPC:on-[NSString unsignedIntegerValue]. No public API change.Testing
xcodebuild test -scheme FirebaseCrashlytics-Unit-unit -destination 'platform=iOS Simulator,name=iPhone 17'Added
testLoadingBinaryImagesWithStringBaseValue, a fixture with one stringbasewhich crashes the current code and is skipped after the change, like the existingnullcase.