Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Crashlytics/Crashlytics/Unwind/Compact/FIRCLSCompactUnwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ bool FIRCLSCompactUnwindLookupSecondLevelCompressed(FIRCLSCompactUnwindContext*
} else {
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);

return false;
}

compact_unwind_encoding_t* encodings = ptr + header->encodingsPageOffset;

result->encoding = encodings[encodingIndex];
Expand Down
Loading