Skip to content

Commit c46a6a1

Browse files
authored
fix: properly parse localeNumberingSystem (#3133)
1 parent bdbe138 commit c46a6a1

File tree

1 file changed

+7
-6
lines changed
  • brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder

1 file changed

+7
-6
lines changed

brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ARSCDecoder.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,13 +500,14 @@ private ResConfigFlags readConfigFlags() throws IOException, AndrolibException {
500500
if (size >= 52) {
501501
screenLayout2 = mIn.readByte();
502502
colorMode = mIn.readByte();
503-
mIn.skipBytes(2); // reserved padding
503+
mIn.skipBytes(2); // screenConfigPad2
504504
read = 52;
505505
}
506506

507-
if (size >= 56) {
508-
mIn.skipBytes(4);
509-
read = 56;
507+
if (size > 52) {
508+
int length = size - read;
509+
mIn.skipBytes(length); // localeNumberingSystem
510+
read += length;
510511
}
511512

512513
int exceedingSize = size - KNOWN_CONFIG_BYTES;
@@ -557,7 +558,7 @@ private char[] unpackLanguageOrRegion(byte in0, byte in1, char base) {
557558
private String readScriptOrVariantChar(int length) throws IOException {
558559
StringBuilder string = new StringBuilder(16);
559560

560-
while(length-- != 0) {
561+
while (length-- != 0) {
561562
short ch = mIn.readByte();
562563
if (ch == 0) {
563564
break;
@@ -641,7 +642,7 @@ private void checkChunkType(int expectedType) throws AndrolibException {
641642
private final static short ENTRY_FLAG_PUBLIC = 0x0002;
642643
private final static short ENTRY_FLAG_WEAK = 0x0004;
643644

644-
private static final int KNOWN_CONFIG_BYTES = 56;
645+
private static final int KNOWN_CONFIG_BYTES = 64;
645646

646647
private static final Logger LOGGER = Logger.getLogger(ARSCDecoder.class.getName());
647648
}

0 commit comments

Comments
 (0)