mirror of
https://github.com/revanced/smali.git
synced 2025-06-12 04:17:36 +02:00
Implemented verification for sput-wide
git-svn-id: https://smali.googlecode.com/svn/trunk@604 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
@ -580,6 +580,8 @@ public class MethodAnalyzer {
|
||||
return handle32BitPrimitiveSput(analyzedInstruction, RegisterType.Category.Char);
|
||||
case SPUT_SHORT:
|
||||
return handle32BitPrimitiveSput(analyzedInstruction, RegisterType.Category.Short);
|
||||
case SPUT_WIDE:
|
||||
return handleSputWide(analyzedInstruction);
|
||||
}
|
||||
|
||||
assert false;
|
||||
@ -2103,6 +2105,34 @@ public class MethodAnalyzer {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleSputWide(AnalyzedInstruction analyzedInstruction) {
|
||||
SingleRegisterInstruction instruction = (SingleRegisterInstruction)analyzedInstruction.instruction;
|
||||
|
||||
|
||||
RegisterType sourceRegisterType = getAndCheckWideSourcePair(analyzedInstruction, instruction.getRegisterA());
|
||||
assert sourceRegisterType != null;
|
||||
if (sourceRegisterType.category == RegisterType.Category.Unknown) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: check access
|
||||
Item referencedItem = ((InstructionWithReference)analyzedInstruction.instruction).getReferencedItem();
|
||||
assert referencedItem instanceof FieldIdItem;
|
||||
FieldIdItem field = (FieldIdItem)referencedItem;
|
||||
|
||||
RegisterType fieldType = RegisterType.getRegisterTypeForTypeIdItem(field.getFieldType());
|
||||
|
||||
if (!WideLowCategories.contains(fieldType.category)) {
|
||||
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,
|
||||
RegisterType.Category instructionCategory) {
|
||||
if (arrayFieldCategory == instructionCategory) {
|
||||
|
Reference in New Issue
Block a user