Skip to content

Commit c42b274

Browse files
committed
CFG: Consider logical not a post order operation.
1 parent e6f587e commit c42b274

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

shared/controlflow/codeql/controlflow/ControlFlowGraph.qll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,14 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
519519
or
520520
n instanceof GotoStmt
521521
or
522+
n instanceof LogicalNotExpr
523+
or
522524
n instanceof Expr and
523525
exists(getChild(n, _)) and
524526
not Input1::preOrderExpr(n) and
525527
not n instanceof LogicalAndExpr and
526528
not n instanceof LogicalOrExpr and
527529
not n instanceof NullCoalescingExpr and
528-
not n instanceof LogicalNotExpr and
529530
not n instanceof ConditionalExpr and
530531
not n instanceof Switch and
531532
not n instanceof Case
@@ -1454,8 +1455,13 @@ module Make0<LocationSig Location, AstSig<Location> Ast> {
14541455
n1.isBefore(notexpr) and
14551456
n2.isBefore(notexpr.getOperand())
14561457
or
1457-
exists(BooleanSuccessor t |
1458-
n1.isAfterValue(notexpr.getOperand(), t) and
1458+
exists(BooleanSuccessor t, PreControlFlowNode operand |
1459+
operand.isAfterValue(notexpr.getOperand(), t)
1460+
|
1461+
n1 = operand and
1462+
n2.isIn(notexpr)
1463+
or
1464+
n1.isIn(notexpr) and
14591465
n2.isAfterValue(notexpr, t.getDual())
14601466
)
14611467
)

0 commit comments

Comments
 (0)