mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-11 20:46:07 +01:00
Correctly handle ResTable_typeSpec by using unsigned bytes to prevent overflow
- fixes #1185 - allows applications that have large typeSpec indexes to work
This commit is contained in:
parent
3a982948ea
commit
e6faa56c96
@ -30,10 +30,10 @@ public final class ResTypeSpec {
|
||||
private final ResTable mResTable;
|
||||
private final ResPackage mPackage;
|
||||
|
||||
private final byte mId;
|
||||
private final int mId;
|
||||
private final int mEntryCount;
|
||||
|
||||
public ResTypeSpec(String name, ResTable resTable, ResPackage package_, byte id, int entryCount) {
|
||||
public ResTypeSpec(String name, ResTable resTable, ResPackage package_, int id, int entryCount) {
|
||||
this.mName = name;
|
||||
this.mResTable = resTable;
|
||||
this.mPackage = package_;
|
||||
@ -45,7 +45,7 @@ public final class ResTypeSpec {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public byte getId() {
|
||||
public int getId() {
|
||||
return mId;
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class ARSCDecoder {
|
||||
|
||||
private ResTypeSpec readSingleTableTypeSpec() throws AndrolibException, IOException {
|
||||
checkChunkType(Header.TYPE_SPEC_TYPE);
|
||||
byte id = mIn.readByte();
|
||||
int id = mIn.readUnsignedByte();
|
||||
mIn.skipBytes(3);
|
||||
int entryCount = mIn.readInt();
|
||||
|
||||
@ -177,7 +177,7 @@ public class ARSCDecoder {
|
||||
|
||||
private ResType readTableType() throws IOException, AndrolibException {
|
||||
checkChunkType(Header.TYPE_TYPE);
|
||||
byte typeId = mIn.readByte();
|
||||
int typeId = mIn.readUnsignedByte();
|
||||
if (mResTypeSpecs.containsKey(typeId)) {
|
||||
mResId = (0xff000000 & mResId) | mResTypeSpecs.get(typeId).getId() << 16;
|
||||
mTypeSpec = mResTypeSpecs.get(typeId);
|
||||
@ -502,7 +502,7 @@ public class ARSCDecoder {
|
||||
private ResType mType;
|
||||
private int mResId;
|
||||
private boolean[] mMissingResSpecs;
|
||||
private HashMap<Byte, ResTypeSpec> mResTypeSpecs = new HashMap<>();
|
||||
private HashMap<Integer, ResTypeSpec> mResTypeSpecs = new HashMap<>();
|
||||
|
||||
private final static short ENTRY_FLAG_COMPLEX = 0x0001;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user