fix(res): as workaround use INVALID_STRING_PLACEHOLDER when string offset is is negative (#2729)(PR #2739)

core: as workaround use INVALID_STRING_PLACEHOLDER when string offset is negative
This commit is contained in:
Jan S.
2026-01-07 17:22:18 +01:00
committed by GitHub
parent 8f727325d6
commit 005a59668c
@@ -45,7 +45,13 @@ public class BinaryXMLStrings {
return INVALID_STRING_PLACEHOLDER;
}
long offset = stringsStart + buffer.getInt(id * 4);
int off = buffer.getInt(id * 4);
if (off < 0) {
// read unsigned offset value is larger than Integer.MAX_VALUE
// In reality this should only happen in obfuscated APKs with invalid offsets
return INVALID_STRING_PLACEHOLDER;
}
long offset = stringsStart + off;
String extracted;
if (isUtf8) {
extracted = extractString8(this.buffer.array(), (int) offset);