mirror of
https://github.com/revanced/smali.git
synced 2025-06-13 04:27:38 +02:00
Implemented verification for if-lt/ge/gt/le
git-svn-id: https://smali.googlecode.com/svn/trunk@584 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
@ -487,6 +487,11 @@ public class MethodAnalyzer {
|
|||||||
case IF_EQ:
|
case IF_EQ:
|
||||||
case IF_NE:
|
case IF_NE:
|
||||||
return handleIfEqNe(analyzedInstruction);
|
return handleIfEqNe(analyzedInstruction);
|
||||||
|
case IF_LT:
|
||||||
|
case IF_GE:
|
||||||
|
case IF_GT:
|
||||||
|
case IF_LE:
|
||||||
|
return handleIf(analyzedInstruction);
|
||||||
}
|
}
|
||||||
assert false;
|
assert false;
|
||||||
return false;
|
return false;
|
||||||
@ -1282,6 +1287,28 @@ public class MethodAnalyzer {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean handleIf(AnalyzedInstruction analyzedInstruction) {
|
||||||
|
TwoRegisterInstruction instruction = (TwoRegisterInstruction)analyzedInstruction.instruction;
|
||||||
|
|
||||||
|
RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterA());
|
||||||
|
assert registerType != null;
|
||||||
|
|
||||||
|
if (registerType.category == RegisterType.Category.Unknown) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
checkRegister(registerType, Primitive32BitCategories);
|
||||||
|
|
||||||
|
registerType = analyzedInstruction.getPreInstructionRegisterType(instruction.getRegisterB());
|
||||||
|
assert registerType != null;
|
||||||
|
|
||||||
|
if (registerType.category == RegisterType.Category.Unknown) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
checkRegister(registerType, Primitive32BitCategories);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static void checkRegister(RegisterType registerType, EnumSet validCategories) {
|
private static void checkRegister(RegisterType registerType, EnumSet validCategories) {
|
||||||
if (!validCategories.contains(registerType.category)) {
|
if (!validCategories.contains(registerType.category)) {
|
||||||
//TODO: add expected categories to error message
|
//TODO: add expected categories to error message
|
||||||
|
Reference in New Issue
Block a user