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: support skipping unread header sizes of ResChunk #3180

Merged
merged 6 commits into from Jul 23, 2023
Merged

Conversation

iBotPeaches
Copy link
Owner

@iBotPeaches iBotPeaches commented Jul 20, 2023

fixes: #2989

Sample application is reporting a larger header size than it should be - packing with bogus data.

00000000: 0200 1000 241c 4200 0100 0000 5353 544b  ....$.B.....SSTK
00000010: 0100 1c00 348b 0e00 a664 0000 0000 0000  ....4....d......
00000020: 0001 0000 b492 0100 0000 0000 0000 0000  ................
00000030: 0e00 0000 1c00 0000 2a00 0000 3800 0000  ........*...8...

Apktool will now compare the difference actually read vs reported to correct.

@iBotPeaches
Copy link
Owner Author

Hmmm want to revisit this. This was written for header size, but depending on chunk type will be checked on chunk full size, which won't have as much protection as intended.

However patching that might require another rework.

@iBotPeaches
Copy link
Owner Author

Okay I do want to merge this, but I'll probably regret it. We need to adjust a split of header/body reading for the chunks. This patch is intended when we have like a 16 byte header, but only read 12 bytes. Its a technique to break tools and we solve it with this.

However, then we read the string block and we read the header then power through and read the data of that pool, so by the time we hit this function you see - the difference is mega negative since we exceeded the header. The function also doesn't really depict its related to solely the header size.

I think I'll put this on hold and add like a onHeaderRead event and lodge it into every chunk read so we have an entry point after the header read prior to body read.

@iBotPeaches iBotPeaches marked this pull request as draft July 21, 2023 11:12
@iBotPeaches iBotPeaches marked this pull request as ready for review July 23, 2023 21:41
@iBotPeaches iBotPeaches merged commit 79f57b0 into master Jul 23, 2023
31 checks passed
@iBotPeaches iBotPeaches deleted the issue-2989 branch July 23, 2023 22:14
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] Decode fails with "Could not decode arsc file"
1 participant