WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 94bdef3

Browse files
committed
Correctly handle float/double divisions
1 parent c72f843 commit 94bdef3

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/main/java/soot/dexpler/DalvikThrowAnalysis.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,16 @@
5454
import soot.SootMethod;
5555
import soot.Type;
5656
import soot.UnknownType;
57+
import soot.Value;
5758
import soot.baf.EnterMonitorInst;
5859
import soot.baf.ReturnInst;
5960
import soot.baf.ReturnVoidInst;
61+
import soot.dexpler.tags.DoubleOpTag;
62+
import soot.dexpler.tags.FloatOpTag;
6063
import soot.jimple.AssignStmt;
6164
import soot.jimple.CastExpr;
6265
import soot.jimple.ClassConstant;
66+
import soot.jimple.DivExpr;
6367
import soot.jimple.EnterMonitorStmt;
6468
import soot.jimple.StringConstant;
6569
import soot.toolkits.exceptions.ThrowableSet;
@@ -226,7 +230,15 @@ public void caseAssignStmt(AssignStmt s) {
226230
// ArrayRef expressions. There is no ArrayStoreException in
227231
// Dalvik.
228232
result = result.add(mightThrow(s.getLeftOp()));
229-
result = result.add(mightThrow(s.getRightOp()));
233+
Value rightOp = s.getRightOp();
234+
if (rightOp instanceof DivExpr && (s.hasTag(FloatOpTag.NAME) || s.hasTag(DoubleOpTag.NAME))) {
235+
// workaround for https://github.com/soot-oss/soot/issues/2188
236+
// skip right op processing - float and double divisions don't throw any exceptions but when
237+
// building the Jimple body the value types are not yet known so we can not know from the expression
238+
// if it is an int or float/double division
239+
} else {
240+
result = result.add(mightThrow(rightOp));
241+
}
230242
}
231243

232244
};

0 commit comments

Comments
 (0)