Skip to content

Commit 1483b6a

Browse files
committed
C++: Fixup queries which assumes that a guard is always an expression.
1 parent dfc3aba commit 1483b6a

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

cpp/ql/src/Likely Bugs/Memory Management/NtohlArrayNoBound.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private module NetworkToBufferSizeConfig implements DataFlow::ConfigSig {
136136

137137
predicate isBarrier(DataFlow::Node node) {
138138
exists(GuardCondition gc, GVN gvn |
139-
gc.getAChild*() = gvn.getAnExpr() and
139+
gc.(Expr).getAChild*() = gvn.getAnExpr() and
140140
globalValueNumber(node.asExpr()) = gvn and
141141
gc.controls(node.asExpr().getBasicBlock(), _)
142142
)

cpp/ql/src/Security/CWE/CWE-295/SSLResultConflation.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ module VerifyResultConfig implements DataFlow::ConfigSig {
2929
predicate isSource(DataFlow::Node source) { source.asExpr() instanceof SslGetVerifyResultCall }
3030

3131
predicate isSink(DataFlow::Node sink) {
32-
exists(GuardCondition guard | guard.getAChild*() = sink.asExpr())
32+
exists(GuardCondition guard | guard.(Expr).getAChild*() = sink.asExpr())
3333
}
3434

3535
predicate observeDiffInformedIncrementalMode() { any() }

cpp/ql/src/Security/CWE/CWE-367/TOCTOUFilesystemRace.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ predicate checksPath(Expr check, Expr checkPath) {
115115

116116
pragma[nomagic]
117117
predicate checkPathControlsUse(Expr check, Expr checkPath, Expr use) {
118-
exists(GuardCondition guard | referenceTo(check, guard.getAChild*()) |
118+
exists(GuardCondition guard | referenceTo(check, guard.(Expr).getAChild*()) |
119119
guard.controls(use.getBasicBlock(), _)
120120
) and
121121
checksPath(pragma[only_bind_into](check), checkPath)
122122
}
123123

124124
pragma[nomagic]
125125
predicate fileNameOperationControlsUse(Expr check, Expr checkPath, Expr use) {
126-
exists(GuardCondition guard | referenceTo(check, guard.getAChild*()) |
126+
exists(GuardCondition guard | referenceTo(check, guard.(Expr).getAChild*()) |
127127
guard.controls(use.getBasicBlock(), _)
128128
) and
129129
pragma[only_bind_into](check) = filenameOperation(checkPath)

cpp/ql/src/experimental/Security/CWE/CWE-401/MemoryLeakOnFailedCallToRealloc.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ReallocCallLeak extends FunctionCall {
5151
predicate mayHandleByTermination() {
5252
exists(GuardCondition guard, CallMayNotReturn exit |
5353
this.(ControlFlowNode).getASuccessor*() = guard and
54-
guard.getAChild*() = v.getAnAccess() and
54+
guard.(Expr).getAChild*() = v.getAnAccess() and
5555
guard.controls(exit.getBasicBlock(), _)
5656
)
5757
}

cpp/ql/test/examples/docs-examples/analyzing-data-flow-in-cpp/index-flow-from-ntohl.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module NetworkToBufferSizeConfig implements DataFlow::ConfigSig {
2222

2323
predicate isBarrier(DataFlow::Node node) {
2424
exists(GuardCondition gc, Variable v |
25-
gc.getAChild*() = v.getAnAccess() and
25+
gc.(Expr).getAChild*() = v.getAnAccess() and
2626
node.asExpr() = v.getAnAccess() and
2727
gc.controls(node.asExpr().getBasicBlock(), _) and
2828
not exists(Loop loop | loop.getControllingExpr() = gc)

0 commit comments

Comments
 (0)