fix: skip parsing if chunk end is reached (#3134)

This commit is contained in:
Connor Tumbleson 2023-07-13 07:27:11 -04:00 committed by GitHub
parent c46a6a13f9
commit 6a28621fcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -305,6 +305,16 @@ public class ARSCDecoder {
}
mMissingResSpecMap.put(i, false);
mResId = (mResId & 0xffff0000) | i;
// As seen in some recent APKs - there are more entries reported than can fit in the chunk.
if (mCountIn.getCount() == mHeader.endPosition) {
int remainingEntries = entryCount - i;
LOGGER.warning(String.format("End of chunk hit. Skipping remaining entries (%d) in type: %s",
remainingEntries, mTypeSpec.getName())
);
break;
}
readEntry(readEntryData());
}