mirror of
https://github.com/revanced/smali.git
synced 2025-06-12 12:17:37 +02:00
Implemented verification for if-eqz/nez
git-svn-id: https://smali.googlecode.com/svn/trunk@585 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
@ -492,6 +492,9 @@ public class MethodAnalyzer {
|
||||
case IF_GT:
|
||||
case IF_LE:
|
||||
return handleIf(analyzedInstruction);
|
||||
case IF_EQZ:
|
||||
case IF_NEZ:
|
||||
return handleIfEqzNez(analyzedInstruction);
|
||||
}
|
||||
assert false;
|
||||
return false;
|
||||
@ -1309,6 +1312,24 @@ public class MethodAnalyzer {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleIfEqzNez(AnalyzedInstruction analyzedInstruction) {
|
||||
SingleRegisterInstruction instruction = (SingleRegisterInstruction)analyzedInstruction.instruction;
|
||||
|
||||
RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterA());
|
||||
assert registerType != null;
|
||||
if (registerType.category == RegisterType.Category.Unknown) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ReferenceCategories.contains(registerType.category) &&
|
||||
!Primitive32BitCategories.contains(registerType.category)) {
|
||||
throw new ValidationException(String.format("%s cannot be used with register type %s. Expecting 32-bit " +
|
||||
"primitive type or reference type.", analyzedInstruction.instruction.opcode));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void checkRegister(RegisterType registerType, EnumSet validCategories) {
|
||||
if (!validCategories.contains(registerType.category)) {
|
||||
//TODO: add expected categories to error message
|
||||
|
Reference in New Issue
Block a user