mirror of
https://github.com/revanced/smali.git
synced 2025-05-20 07:57:06 +02:00
Check for switch offset validity in the MethodAnalyzer
This commit is contained in:
parent
6429b3daa9
commit
5b2943d89b
@ -499,11 +499,19 @@ public class MethodAnalyzer {
|
||||
OffsetInstruction offsetInstruction = (OffsetInstruction)instruction.instruction;
|
||||
|
||||
if (instructionOpcode == Opcode.PACKED_SWITCH || instructionOpcode == Opcode.SPARSE_SWITCH) {
|
||||
SwitchPayload switchPayload = (SwitchPayload)analyzedInstructions.get(instructionCodeAddress +
|
||||
offsetInstruction.getCodeOffset()).instruction;
|
||||
AnalyzedInstruction analyzedSwitchPayload = analyzedInstructions.get(
|
||||
instructionCodeAddress + offsetInstruction.getCodeOffset());
|
||||
if (analyzedSwitchPayload == null) {
|
||||
throw new AnalysisException("Invalid switch payload offset");
|
||||
}
|
||||
SwitchPayload switchPayload = (SwitchPayload)analyzedSwitchPayload.instruction;
|
||||
|
||||
for (SwitchElement switchElement: switchPayload.getSwitchElements()) {
|
||||
AnalyzedInstruction targetInstruction = analyzedInstructions.get(instructionCodeAddress +
|
||||
switchElement.getOffset());
|
||||
if (targetInstruction == null) {
|
||||
throw new AnalysisException("Invalid switch target offset");
|
||||
}
|
||||
|
||||
addPredecessorSuccessor(instruction, targetInstruction, exceptionHandlers,
|
||||
instructionsToProcess);
|
||||
|
Loading…
x
Reference in New Issue
Block a user