From 52a44776dffd52e261b07061d70ffb5282e450d5 Mon Sep 17 00:00:00 2001 From: jamestut Date: Sun, 18 Sep 2016 00:13:19 +0700 Subject: [PATCH] Skip additional payload data of TYPE chunk Some APKs' arsc has additional payload data (like TYPE 8 chunks and/or padding) in the TYPE chunk. After the ARSCDecoder read such kind of chunk, it acts erratically. Most of the time, it just stops parsing the ARSC, therefore, some resources are not decoded because they are not in the apktool's resources' spec table. --- .../main/java/brut/androlib/res/decoder/ARSCDecoder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java index abcb8eaa..e1ded775 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java @@ -154,6 +154,12 @@ public class ARSCDecoder { while (type == Header.TYPE_TYPE) { readTableType(); + + // skip "TYPE 8 chunks" and/or padding data at the end of this chunk + if(mCountIn.getCount() < mHeader.endPosition) { + mCountIn.skip(mHeader.endPosition - mCountIn.getCount()); + } + type = nextChunk().type; addMissingResSpecs();