Skip to content

Commit

Permalink
fix(res): resolve manifest decoding error Expected strings start (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jpstotz authored Mar 10, 2023
1 parent fbdfd13 commit 78c976a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ protected String[] parseStringPoolNoType() throws IOException {
int[] stringsOffset = is.readInt32Array(stringCount);
int[] stylesOffset = is.readInt32Array(styleCount);

is.checkPos(start + stringsStart, "Expected strings start");
is.skipToPos(start + stringsStart, "Expected strings start");
String[] strings = new String[stringCount];
byte[] strData = is.readInt8Array((int) (chunkEnd - is.getPos()));
if ((flags & UTF8_FLAG) != 0) {
Expand Down
4 changes: 4 additions & 0 deletions jadx-core/src/main/java/jadx/core/xmlgen/ParserStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ public void checkPos(long expectedOffset, String error) throws IOException {

public void skipToPos(long expectedOffset, String error) throws IOException {
long pos = getPos();
if (pos > expectedOffset) {
throw new IOException(error + ", expected offset not reachable: 0x" + Long.toHexString(expectedOffset)
+ ", actual: 0x" + Long.toHexString(getPos()));
}
if (pos < expectedOffset) {
skip(expectedOffset - pos);
}
Expand Down

0 comments on commit 78c976a

Please sign in to comment.