mirror of
https://github.com/revanced/smali.git
synced 2025-05-05 17:14:25 +02:00
Implemented verification for sget-object
git-svn-id: https://smali.googlecode.com/svn/trunk@602 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
parent
2f233fefd9
commit
2d6d6eb22c
@ -568,6 +568,8 @@ public class MethodAnalyzer {
|
||||
return handle32BitPrimitiveSget(analyzedInstruction, RegisterType.Category.Short);
|
||||
case SGET_WIDE:
|
||||
return handleSgetWide(analyzedInstruction);
|
||||
case SGET_OBJECT:
|
||||
return handleSgetObject(analyzedInstruction);
|
||||
}
|
||||
|
||||
assert false;
|
||||
@ -2032,6 +2034,25 @@ public class MethodAnalyzer {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleSgetObject(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.Reference) {
|
||||
throw new ValidationException(String.format("Cannot use %s with field %s. Incorrect field type " +
|
||||
"for the instruction.", analyzedInstruction.instruction.opcode.name,
|
||||
field.getFieldString()));
|
||||
}
|
||||
|
||||
setDestinationRegisterTypeAndPropagateChanges(analyzedInstruction, fieldType);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean checkArrayFieldAssignment(RegisterType.Category arrayFieldCategory,
|
||||
RegisterType.Category instructionCategory) {
|
||||
if (arrayFieldCategory == instructionCategory) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user