Skip to content

Commit b2a4bd6

Browse files
committed
Fix: Correctly check bin xml chunk header REAndroid/APKEditor#209
1 parent d672e7f commit b2a4bd6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/com/reandroid/arsc/chunk/xml/ResXmlDocument.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,17 @@ public static boolean isResXmlBlock(BlockReader blockReader){
339339
}
340340
}
341341
public static boolean isResXmlBlock(HeaderBlock headerBlock){
342-
if(headerBlock==null){
342+
if (headerBlock == null) {
343343
return false;
344344
}
345345
ChunkType chunkType=headerBlock.getChunkType();
346-
return chunkType==ChunkType.XML;
346+
if (chunkType != ChunkType.XML) {
347+
return false;
348+
}
349+
int headerSize = headerBlock.getHeaderSize();
350+
if (headerSize < 8) {
351+
return false;
352+
}
353+
return headerBlock.getChunkSize() > headerSize;
347354
}
348355
}

0 commit comments

Comments
 (0)