mirror of
https://github.com/revanced/smali.git
synced 2025-05-23 18:16:23 +02:00
Fixed issue when reading an array-data pseudo instruction whose data ended in the middle of a 2-byte word
git-svn-id: https://smali.googlecode.com/svn/trunk@173 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
3c9013f9c0
commit
57b919fdf2
@ -60,6 +60,10 @@ public class ArrayDataPseudoInstruction extends Instruction
|
||||
|
||||
int elementCount = byteCount / elementWidth;
|
||||
|
||||
if (byteCount % 2 != 0) {
|
||||
byteCount++;
|
||||
}
|
||||
|
||||
encodedInstruction = new byte[byteCount+8];
|
||||
encodedInstruction[0] = 0x00;
|
||||
encodedInstruction[1] = 0x03; //fill-array-data psuedo-opcode
|
||||
@ -106,6 +110,13 @@ public class ArrayDataPseudoInstruction extends Instruction
|
||||
for (int i=0; i<size; i++) {
|
||||
elementsList.add(input.readBytes(elementWidth));
|
||||
}
|
||||
|
||||
if ((size * elementWidth) % 2 != 0) {
|
||||
//the basic unit in an instruction stream in a 2-byte word. If
|
||||
//the end of the array falls in the middle of a word, we need to
|
||||
//read (and discard) the last byte of the word
|
||||
input.readByte();
|
||||
}
|
||||
|
||||
return new ArrayDataPseudoInstruction(dexFile, elementWidth, elementsList);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user