Skip to content

Commit d671cc6

Browse files
authored
Merge pull request #12052 from hmac/barrier-guard-fix
2 parents 255f989 + da45d3a commit d671cc6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ruby/ql/lib/codeql/ruby/dataflow/BarrierGuards.qll

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ private predicate stringConstCompare(CfgNodes::AstCfgNode guard, CfgNode testedN
1515
c = guard and
1616
exists(ExprCfgNode strNode |
1717
strNode.getConstantValue().isStringlikeValue(_) and
18-
c.getExpr() instanceof EqExpr and
19-
branch = true
20-
or
21-
c.getExpr() instanceof CaseEqExpr and branch = true
22-
or
23-
c.getExpr() instanceof NEExpr and branch = false
18+
(
19+
c.getExpr() instanceof EqExpr and
20+
branch = true
21+
or
22+
c.getExpr() instanceof CaseEqExpr and branch = true
23+
or
24+
c.getExpr() instanceof NEExpr and branch = false
25+
)
2426
|
2527
c.getLeftOperand() = strNode and c.getRightOperand() = testedNode
2628
or

ruby/ql/test/library-tests/dataflow/barrier-guards/barrier-guards.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ oldStyleBarrierGuards
1414
| barrier-guards.rb:43:4:43:15 | ... == ... | barrier-guards.rb:45:9:45:11 | foo | barrier-guards.rb:43:4:43:6 | foo | true |
1515
| barrier-guards.rb:43:4:43:15 | ... == ... | barrier-guards.rb:45:9:45:11 | foo | barrier-guards.rb:43:11:43:15 | "foo" | true |
1616
| barrier-guards.rb:70:4:70:21 | call to include? | barrier-guards.rb:71:5:71:7 | foo | barrier-guards.rb:70:18:70:20 | foo | true |
17-
| barrier-guards.rb:82:4:82:25 | ... != ... | barrier-guards.rb:83:5:83:7 | foo | barrier-guards.rb:82:4:82:18 | call to index | false |
1817
| barrier-guards.rb:82:4:82:25 | ... != ... | barrier-guards.rb:83:5:83:7 | foo | barrier-guards.rb:82:15:82:17 | foo | true |
19-
| barrier-guards.rb:82:4:82:25 | ... != ... | barrier-guards.rb:83:5:83:7 | foo | barrier-guards.rb:82:23:82:25 | nil | false |
2018
| barrier-guards.rb:207:4:207:15 | ... == ... | barrier-guards.rb:208:5:208:7 | foo | barrier-guards.rb:207:4:207:6 | foo | true |
2119
| barrier-guards.rb:211:10:211:21 | ... == ... | barrier-guards.rb:212:5:212:7 | foo | barrier-guards.rb:211:10:211:12 | foo | true |
2220
| barrier-guards.rb:215:16:215:27 | ... == ... | barrier-guards.rb:216:5:216:7 | foo | barrier-guards.rb:215:16:215:18 | foo | true |

0 commit comments

Comments
 (0)