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: skip parsing if chunk end is reached within table chunk #3134

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

iBotPeaches
Copy link
Owner

fixes: #3036

This cannot be a valid application, but the entriesCount seems to be lying. We exceed the chunk size before we are done reading the items. This makes sense in a way because ending the chunk reading when limit is fixed - does correct parsing

However, I am confused how tools like arscblamer, android studio, etc are reading all assets with no skipping of chunks. So perhaps this data is somewhere else, but I'm not sure where. The spec states

https://github.com/aosp-mirror/platform_frameworks_base/blob/main/libs/androidfw/include/androidfw/ResourceTypes.h#L1228

    // Number of uint32_t entry indices that follow.
    uint32_t entryCount;

    // Offset from header where ResTable_entry data starts.
    uint32_t entriesStart;

I've confirmed:

  • We are starting reading the entries at correct offset
  • We properly read the count
  • Reading past the chunk limit does crash quite quick

@iBotPeaches iBotPeaches merged commit 6a28621 into master Jul 13, 2023
@iBotPeaches iBotPeaches deleted the issue-3036-skip-chunks branch July 13, 2023 11:27
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.

[BUG] Expected: 0x00000008, got: 0x00000005 - WhatsApp
1 participant