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:
JesusFreke@JesusFreke.com 2009-06-20 19:57:29 +00:00
parent 3c9013f9c0
commit 57b919fdf2

View File

@ -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
@ -107,6 +111,13 @@ public class ArrayDataPseudoInstruction extends Instruction
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);
}