mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Swaps ...obj for ...val
This commit is contained in:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user