Fix how the address for the array data is calculated

git-svn-id: https://smali.googlecode.com/svn/trunk@581 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com
2010-01-24 19:35:35 +00:00
parent cda44f70cf
commit b7e7811527

View File

@ -1122,11 +1122,12 @@ public class MethodAnalyzer {
} }
int arrayDataOffset = ((OffsetInstruction)analyzedInstruction.instruction).getTargetAddressOffset(); int arrayDataAddressOffset = ((OffsetInstruction)analyzedInstruction.instruction).getTargetAddressOffset();
AnalyzedInstruction arrayDataInstruction = this.instructions.get(arrayDataOffset); int arrayDataCodeAddress = getInstructionAddress(analyzedInstruction) + arrayDataAddressOffset;
AnalyzedInstruction arrayDataInstruction = this.instructions.get(arrayDataCodeAddress);
if (arrayDataInstruction == null || arrayDataInstruction.instruction.getFormat() != Format.ArrayData) { if (arrayDataInstruction == null || arrayDataInstruction.instruction.getFormat() != Format.ArrayData) {
throw new ValidationException(String.format("Could not find an array data structure at code address 0x%x", throw new ValidationException(String.format("Could not find an array data structure at code address 0x%x",
arrayDataOffset)); arrayDataCodeAddress));
} }
ArrayDataPseudoInstruction arrayDataPseudoInstruction = ArrayDataPseudoInstruction arrayDataPseudoInstruction =
@ -1135,7 +1136,7 @@ public class MethodAnalyzer {
if (elementWidth != arrayDataPseudoInstruction.getElementWidth()) { if (elementWidth != arrayDataPseudoInstruction.getElementWidth()) {
throw new ValidationException(String.format("The array data at code address 0x%x does not have the " + throw new ValidationException(String.format("The array data at code address 0x%x does not have the " +
"correct element width for array type %s. Expecting element width %d, got element width %d.", "correct element width for array type %s. Expecting element width %d, got element width %d.",
arrayDataOffset, arrayClassDef.getClassType(), elementWidth, arrayDataCodeAddress, arrayClassDef.getClassType(), elementWidth,
arrayDataPseudoInstruction.getElementWidth())); arrayDataPseudoInstruction.getElementWidth()));
} }