mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 09:04:25 +02:00
Implemented verification for sget-wide
git-svn-id: https://smali.googlecode.com/svn/trunk@601 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
bd215cd95b
commit
2f233fefd9
@ -566,6 +566,8 @@ public class MethodAnalyzer {
|
|||||||
return handle32BitPrimitiveSget(analyzedInstruction, RegisterType.Category.Char);
|
return handle32BitPrimitiveSget(analyzedInstruction, RegisterType.Category.Char);
|
||||||
case SGET_SHORT:
|
case SGET_SHORT:
|
||||||
return handle32BitPrimitiveSget(analyzedInstruction, RegisterType.Category.Short);
|
return handle32BitPrimitiveSget(analyzedInstruction, RegisterType.Category.Short);
|
||||||
|
case SGET_WIDE:
|
||||||
|
return handleSgetWide(analyzedInstruction);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert false;
|
assert false;
|
||||||
@ -2008,6 +2010,28 @@ public class MethodAnalyzer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean handleSgetWide(AnalyzedInstruction analyzedInstruction) {
|
||||||
|
//TODO: check access
|
||||||
|
Item referencedItem = ((InstructionWithReference)analyzedInstruction.instruction).getReferencedItem();
|
||||||
|
assert referencedItem instanceof FieldIdItem;
|
||||||
|
FieldIdItem field = (FieldIdItem)referencedItem;
|
||||||
|
|
||||||
|
RegisterType fieldType = RegisterType.getRegisterTypeForTypeIdItem(field.getFieldType());
|
||||||
|
|
||||||
|
|
||||||
|
if (fieldType.category != RegisterType.Category.LongLo &&
|
||||||
|
fieldType.category != RegisterType.Category.DoubleLo) {
|
||||||
|
|
||||||
|
throw new ValidationException(String.format("Cannot use %s with field %s. Incorrect field type " +
|
||||||
|
"for the instruction.", analyzedInstruction.instruction.opcode.name,
|
||||||
|
field.getFieldString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
setWideDestinationRegisterTypeAndPropagateChanges(analyzedInstruction, fieldType);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean checkArrayFieldAssignment(RegisterType.Category arrayFieldCategory,
|
private static boolean checkArrayFieldAssignment(RegisterType.Category arrayFieldCategory,
|
||||||
RegisterType.Category instructionCategory) {
|
RegisterType.Category instructionCategory) {
|
||||||
if (arrayFieldCategory == instructionCategory) {
|
if (arrayFieldCategory == instructionCategory) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user