From 9b1c7d22ef7ef14207b781164a25c892b5da54af Mon Sep 17 00:00:00 2001 From: Connor Tumbleson Date: Sat, 1 Nov 2014 21:21:35 -0500 Subject: [PATCH] JEB - Fix decompressor when string arrays aren't 4-byte aligned --- .../brut/androlib/res/decoder/StringBlock.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java index d2b110fd..72ba3ba8 100644 --- a/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java +++ b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/StringBlock.java @@ -62,18 +62,20 @@ public class StringBlock { } { int size = ((stylesOffset == 0) ? chunkSize : stylesOffset) - stringsOffset; - if ((size % 4) != 0) { - throw new IOException("String data size is not multiple of 4 (" + size + ")."); - } block.m_strings = new byte[size]; reader.readFully(block.m_strings); } if (stylesOffset != 0) { int size = (chunkSize - stylesOffset); - if ((size % 4) != 0) { - throw new IOException("Style data size is not multiple of 4 (" + size + ")."); - } block.m_styles = reader.readIntArray(size / 4); + + // read remaining bytes + int remaining = size % 4; + if (remaining >= 1) { + while (remaining-- > 0) { + reader.readByte(); + } + } } return block;