Skip to content

bound compressed encoding index in compact unwind lookup - #16559

Open
isl-Ramzi wants to merge 1 commit into
firebase:mainfrom
isl-Ramzi:compact-unwind-encoding-index-bound
Open

bound compressed encoding index in compact unwind lookup#16559
isl-Ramzi wants to merge 1 commit into
firebase:mainfrom
isl-Ramzi:compact-unwind-encoding-index-bound

Conversation

@isl-Ramzi

Copy link
Copy Markdown
Contributor

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.

@gemini-code-assist

Copy link
Copy Markdown
Contributor
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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.

@paulb777

Copy link
Copy Markdown
Member

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

low

To improve debuggability when encountering corrupt or malformed unwind info, it would be helpful to include the out-of-range index and the maximum allowed count in the log message.

      FIRCLSSDKLog("Error: compressed encoding index out of range (%u >= %u)\n", encodingIndex, header->encodingsCount);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants