mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-05 02:22:55 +01:00
Merge pull request #1977 from sebras/master
Adapt AXMLResourceParser to handle broken headers.
This commit is contained in:
commit
d7f9be9200
@ -852,7 +852,7 @@ public class AXmlResourceParser implements XmlResourceParser {
|
||||
private final void doNext() throws IOException {
|
||||
// Delayed initialization.
|
||||
if (m_strings == null) {
|
||||
m_reader.skipCheckInt(CHUNK_AXML_FILE);
|
||||
m_reader.skipCheckInt(CHUNK_AXML_FILE, CHUNK_AXML_FILE_BROKEN);
|
||||
|
||||
/*
|
||||
* chunkSize
|
||||
@ -1004,7 +1004,7 @@ public class AXmlResourceParser implements XmlResourceParser {
|
||||
ATTRIBUTE_IX_VALUE_TYPE = 3, ATTRIBUTE_IX_VALUE_DATA = 4,
|
||||
ATTRIBUTE_LENGTH = 5;
|
||||
|
||||
private static final int CHUNK_AXML_FILE = 0x00080003,
|
||||
private static final int CHUNK_AXML_FILE = 0x00080003, CHUNK_AXML_FILE_BROKEN = 0x00080001,
|
||||
CHUNK_RESOURCEIDS = 0x00080180, CHUNK_XML_FIRST = 0x00100100,
|
||||
CHUNK_XML_START_NAMESPACE = 0x00100100,
|
||||
CHUNK_XML_END_NAMESPACE = 0x00100101,
|
||||
|
@ -42,11 +42,11 @@ public class ExtDataInput extends DataInputDelegate {
|
||||
skipBytes(4);
|
||||
}
|
||||
|
||||
public void skipCheckInt(int expected) throws IOException {
|
||||
public void skipCheckInt(int expected1, int expected2) throws IOException {
|
||||
int got = readInt();
|
||||
if (got != expected) {
|
||||
if (got != expected1 && got != expected2) {
|
||||
throw new IOException(String.format(
|
||||
"Expected: 0x%08x, got: 0x%08x", expected, got));
|
||||
"Expected: 0x%08x or 0x%08x, got: 0x%08x", expected1, expected2, got));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user