Skip to content

Commit

Permalink
fix: skip parsing if chunk end is reached (#3134)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Jul 13, 2023
1 parent c46a6a1 commit 6a28621
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@ private ResType readTableType() throws IOException, AndrolibException {
}
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());
}

Expand Down

0 comments on commit 6a28621

Please sign in to comment.