From f63bbc0be22ba7fea659e88298af78b066433092 Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sat, 30 Sep 2023 07:21:58 -0400 Subject: [PATCH] fix: handle duplicate res entries during a complex resource (#3347) --- .../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 90bc296c..371aedd5 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 @@ -415,6 +415,12 @@ public class ARSCDecoder { resId = mIn.readInt(); resValue = readValue(); + // #2824 - In some applications the res entries are duplicated with the 2nd being malformed. + // AOSP skips this, so we will do the same. + if (resValue == null) { + continue; + } + if (!(resValue instanceof ResScalarValue)) { resValue = new ResStringValue(resValue.toString(), resValue.getRawIntValue()); }