Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions jadx-core/src/main/java/jadx/core/xmlgen/ResTableBinaryParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,33 +275,33 @@ private void parseTypeChunk(long start, PackageChunk pkg) throws IOException {
}
}
is.skipToPos(entriesStart, "Failed to skip to entries start");
int ignoredEoc = 0; // ignored entries because they are located after end of chunk
for (EntryOffset entryOffset : offsets) {
int offset = entryOffset.getOffset();
if (offset == NO_ENTRY) {
continue;
}
int index = entryOffset.getIdx();
if (is.getPos() >= chunkEnd) {
long entryStartOffset = entriesStart + offset;
if (entryStartOffset >= chunkEnd) {
// Certain resource obfuscated apps like com.facebook.orca have more entries defined
// than actually fit into the chunk size -> ignore the remaining entries
LOG.warn("End of chunk reached - ignoring remaining {} entries in type: {}", entryCount - index, typeName);
break;
// than actually fit into the chunk size -> ignore this entry
ignoredEoc++;
// LOG.debug("Pos is after chunk end: {} end {}", entryStartOffset, chunkEnd);
continue;
}
long entryStartOffset = entriesStart + offset;
if (entryStartOffset < is.getPos()) {
// workaround for issue #2343: if the entryStartOffset is located before our current position
is.reset();
}
int index = entryOffset.getIdx();
is.skipToPos(entryStartOffset, "Expected start of entry " + index);
parseEntry(pkg, id, index, config.getQualifiers());
}
if (chunkEnd > is.getPos()) {
// Skip remaining unknown data in this chunk (e.g. type 8 entries")
long skipSize = chunkEnd - is.getPos();
LOG.debug("Unknown data at the end of type chunk encountered, skipping {} bytes and continuing at offset {}", skipSize,
chunkEnd);
is.skip(skipSize);
if (ignoredEoc > 0) {
// invalid = data offset is after the chunk end
LOG.warn("{} entries of type {} has been ignored (invalid offset)", ignoredEoc, typeName);
}
is.skipToPos(chunkEnd, "End of chunk");
}

private static class EntryOffset {
Expand Down