bound compressed encoding index in compact unwind lookup - #16559
bound compressed encoding index in compact unwind lookup#16559isl-Ramzi wants to merge 1 commit 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 adds a bounds check in FIRCLSCompactUnwindLookupSecondLevelCompressed to prevent an out-of-bounds array access when retrieving a compressed encoding. The review feedback suggests enhancing the log message to include the out-of-range index and the maximum allowed count to improve debuggability.
| encodingIndex = encodingIndex - context->unwindHeader.commonEncodingsArrayCount; | ||
|
|
||
| if (encodingIndex >= header->encodingsCount) { | ||
| FIRCLSSDKLog("Error: compressed encoding index out of range\n"); |
There was a problem hiding this comment.
FIRCLSCompactUnwindLookupSecondLevelCompressed reads the encoding index from the high byte of a compressed second-level entry, and the common-encodings branch bounds that index against commonEncodingsArrayCount while the page-local branch indexes encodings[] with no check, so a corrupt or crafted __unwind_info page whose index exceeds the page's encodingsCount reads past the encodings array during crash-time unwinding. Add the encodingsCount bound before the read, matching the check already applied a few lines above.