Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Don't crash with a buffer underflow when packageCount == 0 #126

Merged
merged 1 commit into from Sep 8, 2020

Conversation

paulo-raca
Copy link
Contributor

@paulo-raca paulo-raca commented May 11, 2020

This fixes #125

I don't normally see this issue, the particular exception is on com.citymapper.app.release,
versionCode 1009500, inside split_kyc2.config.xxxhdpi

@AndroidDeveloperLB
Copy link

Wait why does it occur? Did you run the sample app I've put against the APK files I've attached?

How did you find the cause and the fix? Is it now completely fixed?

@paulo-raca
Copy link
Contributor Author

paulo-raca commented May 11, 2020

Did you run the sample app I've put against the APK files I've attached?

Apologies for being dumb, but what sample app? Attached where?

However I did run mvn test

How did you find the cause and the fix? Is it now completely fixed?

I debugged ResourceTableParser.parse() and found that:

  • resources.arsc is really small (40 bytes)
  • resourceTableHeader.getPackageCount() is zero
  • The string pool is empty
  • It reaches the end of buffer right before reading packageHeader.

Considering there are zero packages, it seemed reasonable to skip reading packageHeader, and it fixes the problem to me.

@paulo-raca
Copy link
Contributor Author

paulo-raca commented May 11, 2020

Oh, the problematic apks.zip attached to #125!
I Just tested them, they work fine now :)

@AndroidDeveloperLB
Copy link

I see. Can you please check the other issues I've reported, too?
Here:
#99
#108
#119
#122
#123

@AndroidDeveloperLB
Copy link

AndroidDeveloperLB commented May 16, 2020

I don't see a crash on split_kyc2.config.xxxhdpi . Attached here:

split_kyc2.config.xxxhdpi.apk.zip

Can you make a sample to show that it crashes, using the official repository?

@hsiafan hsiafan merged commit 9642d7b into hsiafan:master Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: crash when trying to parse some APK files
3 participants