Skip to content

Commit

Permalink
Do not check for switch loops that also may happen in the wild
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcMil committed Oct 19, 2024
1 parent 72b7640 commit e105f6a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/soot/dexpler/DexBody.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
import soot.jimple.toolkits.scalar.NopEliminator;
import soot.jimple.toolkits.scalar.UnconditionalBranchFolder;
import soot.jimple.toolkits.scalar.UnreachableCodeEliminator;
import soot.jimple.toolkits.typing.fast.BottomType;
import soot.jimple.toolkits.typing.fast.DefaultTypingStrategy;
import soot.jimple.toolkits.typing.fast.ITypingStrategy;
import soot.jimple.toolkits.typing.fast.TypePromotionUseVisitor;
Expand Down Expand Up @@ -1091,7 +1092,7 @@ public Value visit(Value op, Type useType, Stmt stmt, boolean checkOnly) {
//
for (Local l : jBody.getLocals()) {
Type t = l.getType();
if (t instanceof NullType) {
if (t instanceof NullType || t instanceof BottomType) {
l.setType(objectType);
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/soot/toDex/StmtVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -784,9 +784,6 @@ public void caseLookupSwitchStmt(LookupSwitchStmt stmt) {
// create sparse-switch instruction that references the payload
Value key = stmt.getKey();
Stmt defaultTarget = (Stmt) stmt.getDefaultTarget();
if (defaultTarget == stmt) {
throw new RuntimeException("Looping switch block detected");
}
addInsn(buildSwitchInsn(Opcode.SPARSE_SWITCH, key, defaultTarget, payload, stmt), stmt);
}

Expand Down

0 comments on commit e105f6a

Please sign in to comment.