mirror of
https://github.com/revanced/smali.git
synced 2025-06-12 12:17:37 +02:00
Fixed an issue with alignment for the pseudo opcodes, and a test to exercise the issue
git-svn-id: https://smali.googlecode.com/svn/trunk@153 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
@ -39,8 +39,14 @@ import java.util.ArrayList;
|
||||
|
||||
public class ArrayDataPseudoInstruction extends Instruction
|
||||
{
|
||||
private int elementWidth;
|
||||
private List<byte[]> values;
|
||||
|
||||
public ArrayDataPseudoInstruction(DexFile dexFile, int elementWidth, List<byte[]> values) {
|
||||
super(dexFile, Opcode.NOP, (IndexedItem)null);
|
||||
|
||||
this.elementWidth = elementWidth;
|
||||
this.values = values;
|
||||
|
||||
int byteCount = 0;
|
||||
|
||||
@ -88,7 +94,7 @@ public class ArrayDataPseudoInstruction extends Instruction
|
||||
throw new RuntimeException("Invalid opcode byte for an ArrayData pseudo-instruction");
|
||||
}
|
||||
byte subopcodeByte = input.readByte();
|
||||
if (subopcodeByte != 0x02) {
|
||||
if (subopcodeByte != 0x03) {
|
||||
throw new RuntimeException("Invalid sub-opcode byte for an ArrayData pseudo-instruction");
|
||||
}
|
||||
|
||||
@ -111,4 +117,12 @@ public class ArrayDataPseudoInstruction extends Instruction
|
||||
protected Instruction makeClone() {
|
||||
return new ArrayDataPseudoInstruction();
|
||||
}
|
||||
|
||||
public int getElementWidth() {
|
||||
return elementWidth;
|
||||
}
|
||||
|
||||
public List<byte[]> getValues() {
|
||||
return values;
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,13 @@ import org.jf.dexlib.util.Input;
|
||||
|
||||
public class PackedSwitchDataPseudoInstruction extends Instruction
|
||||
{
|
||||
private int firstKey;
|
||||
private int[] targets;
|
||||
|
||||
public PackedSwitchDataPseudoInstruction(DexFile dexFile, int firstKey, int[] targets) {
|
||||
super(dexFile, Opcode.NOP, (IndexedItem)null);
|
||||
this.firstKey = firstKey;
|
||||
this.targets = targets;
|
||||
|
||||
if (targets.length > 0xFFFF) {
|
||||
throw new RuntimeException("The packed-switch data contains too many elements. " +
|
||||
@ -100,6 +105,14 @@ public class PackedSwitchDataPseudoInstruction extends Instruction
|
||||
}
|
||||
|
||||
public Format getFormat() {
|
||||
return Format.SparseSwitchData;
|
||||
return Format.PackedSwitchData;
|
||||
}
|
||||
|
||||
public int getFirstKey() {
|
||||
return firstKey;
|
||||
}
|
||||
|
||||
public int[] getTargets() {
|
||||
return targets;
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,15 @@ import org.jf.dexlib.util.Input;
|
||||
|
||||
public class SparseSwitchDataPseudoInstruction extends Instruction
|
||||
{
|
||||
private int[] keys;
|
||||
private int[] targets;
|
||||
|
||||
public SparseSwitchDataPseudoInstruction(DexFile dexFile, int[] keys, int[] targets) {
|
||||
super(dexFile, Opcode.NOP, (IndexedItem)null);
|
||||
|
||||
this.keys = keys;
|
||||
this.targets = targets;
|
||||
|
||||
if (keys.length != targets.length) {
|
||||
throw new RuntimeException("The number of keys and offsets don't match");
|
||||
}
|
||||
@ -130,4 +136,12 @@ public class SparseSwitchDataPseudoInstruction extends Instruction
|
||||
public Format getFormat() {
|
||||
return Format.SparseSwitchData;
|
||||
}
|
||||
|
||||
public int[] getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
public int[] getTargets() {
|
||||
return targets;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user