mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-22 17:57:35 +01:00
Read res header completely
This commit is contained in:
parent
ba9b4af973
commit
3cdd8243c7
@ -248,6 +248,8 @@ public class ARSCDecoder {
|
|||||||
private ResConfigFlags readConfigFlags() throws IOException,
|
private ResConfigFlags readConfigFlags() throws IOException,
|
||||||
AndrolibException {
|
AndrolibException {
|
||||||
int size = mIn.readInt();
|
int size = mIn.readInt();
|
||||||
|
int read = 0;
|
||||||
|
|
||||||
if (size < 28) {
|
if (size < 28) {
|
||||||
throw new AndrolibException("Config size < 28");
|
throw new AndrolibException("Config size < 28");
|
||||||
}
|
}
|
||||||
@ -283,6 +285,7 @@ public class ARSCDecoder {
|
|||||||
screenLayout = mIn.readByte();
|
screenLayout = mIn.readByte();
|
||||||
uiMode = mIn.readByte();
|
uiMode = mIn.readByte();
|
||||||
smallestScreenWidthDp = mIn.readShort();
|
smallestScreenWidthDp = mIn.readShort();
|
||||||
|
read = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
short screenWidthDp = 0;
|
short screenWidthDp = 0;
|
||||||
@ -290,6 +293,7 @@ public class ARSCDecoder {
|
|||||||
if (size >= 36) {
|
if (size >= 36) {
|
||||||
screenWidthDp = mIn.readShort();
|
screenWidthDp = mIn.readShort();
|
||||||
screenHeightDp = mIn.readShort();
|
screenHeightDp = mIn.readShort();
|
||||||
|
read = 36;
|
||||||
}
|
}
|
||||||
|
|
||||||
char[] localeScript = null;
|
char[] localeScript = null;
|
||||||
@ -297,6 +301,7 @@ public class ARSCDecoder {
|
|||||||
if (size >= 48) {
|
if (size >= 48) {
|
||||||
localeScript = readScriptOrVariantChar(4).toCharArray();
|
localeScript = readScriptOrVariantChar(4).toCharArray();
|
||||||
localeVariant = readScriptOrVariantChar(8).toCharArray();
|
localeVariant = readScriptOrVariantChar(8).toCharArray();
|
||||||
|
read = 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
int exceedingSize = size - KNOWN_CONFIG_BYTES;
|
int exceedingSize = size - KNOWN_CONFIG_BYTES;
|
||||||
@ -316,6 +321,11 @@ public class ARSCDecoder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int remainingSize = size - read;
|
||||||
|
if (remainingSize > 0) {
|
||||||
|
mIn.skipBytes(remainingSize);
|
||||||
|
}
|
||||||
|
|
||||||
return new ResConfigFlags(mcc, mnc, language, country,
|
return new ResConfigFlags(mcc, mnc, language, country,
|
||||||
orientation, touchscreen, density, keyboard, navigation,
|
orientation, touchscreen, density, keyboard, navigation,
|
||||||
inputFlags, screenWidth, screenHeight, sdkVersion,
|
inputFlags, screenWidth, screenHeight, sdkVersion,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user