Swaps ...obj for ...val

This commit is contained in:
Rebecca Valentine
2020-02-17 11:12:06 -08:00
parent 91ea46f5ee
commit 5acd982d59

View File

@@ -18,15 +18,15 @@ where
// Only relevant for Python 2, as all later versions implement true division
major_version() = 2
and
exists(BinaryExprNode bin, Value lobj, Value robj |
exists(BinaryExprNode bin, Value lval, Value rval |
bin = div.getAFlowNode()
and bin.getNode().getOp() instanceof Div
and bin.getLeft().pointsTo(lobj, left)
and lobj.getClass() = ClassValue::int_()
and bin.getRight().pointsTo(robj, right)
and robj.getClass() = ClassValue::int_()
and bin.getLeft().pointsTo(lval, left)
and lval.getClass() = ClassValue::int_()
and bin.getRight().pointsTo(rval, right)
and rval.getClass() = ClassValue::int_()
// Ignore instances where integer division leaves no remainder
and not lobj.(NumericValue).intValue() % robj.(NumericValue).intValue() = 0
and not lval.(NumericValue).intValue() % rval.(NumericValue).intValue() = 0
and not bin.getNode().getEnclosingModule().hasFromFuture("division")
// Filter out results wrapped in `int(...)`
and not exists(CallNode c, ClassValue cls |