fix(res): resolve manifest decoding error Expected strings start (#1797)(PR #1798)

This commit is contained in:
Jan S
2023-03-10 16:46:31 +01:00
committed by GitHub
parent fbdfd135da
commit 78c976ad4f
2 changed files with 5 additions and 1 deletions
@@ -26,7 +26,7 @@ public class CommonBinaryParser extends ParserConstants {
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) {
@@ -127,6 +127,10 @@ public class ParserStream {
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);
}