Skip to content

Commit 1f68a2f

Browse files
committed
C++: Fix up queries after github/codeql#20485.
1 parent e293289 commit 1f68a2f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

c/cert/src/rules/EXP16-C/DoNotCompareFunctionPointersToConstantValues.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ExplicitComparison extends EffectivelyComparison, FinalComparisonOperation
5151
override FunctionExpr getFunctionExpr() { result = funcExpr }
5252
}
5353

54-
class ImplicitComparison extends EffectivelyComparison, GuardCondition {
54+
class ImplicitComparison extends EffectivelyComparison, GuardCondition instanceof Expr {
5555
ImplicitComparison() {
5656
this instanceof FunctionExpr and
5757
not getParent() instanceof ComparisonOperation

cpp/cert/src/rules/CTR55-CPP/DoNotUseAnAdditiveOperatorOnAnIterator.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ predicate isUpperBoundEndCheckedIteratorAccess(IteratorSource source, ContainerI
7878
basicBlockOfIteratorAccess.contains(it) and
7979
//guard is comprised of end check and an iterator access
8080
DataFlow::localFlow(DataFlow::exprNode(referenceToOnePassedTheEndElement),
81-
DataFlow::exprNode(upperBoundCheck.getChild(_))) and
82-
upperBoundCheck.getChild(_) = checkedIteratorAccess and
81+
DataFlow::exprNode(upperBoundCheck.(Expr).getChild(_))) and
82+
upperBoundCheck.(Expr).getChild(_) = checkedIteratorAccess and
8383
//make sure its the same iterator being checked in the guard as accessed
8484
checkedIteratorAccess.getOwningContainer() = it.getOwningContainer() and
8585
//if its the end call itself (or its parts), make sure its the same container providing its end as giving the iterator

cpp/cert/src/rules/MEM52-CPP/DetectAndHandleMemoryAllocationErrors.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class NoThrowAllocExprWrapperFunction extends Function {
6363
n.getEnclosingFunction() = this and
6464
DataFlow::localExprFlow(n, any(ReturnStmt rs).getExpr()) and
6565
// Not checked in this wrapper function
66-
not exists(GuardCondition gc | DataFlow::localExprFlow(n, gc.getAChild*()))
66+
not exists(GuardCondition gc | DataFlow::localExprFlow(n, gc.(Expr).getAChild*()))
6767
}
6868

6969
/** Gets the underlying nothrow allocation ultimately being wrapped. */

cpp/common/src/codingstandards/cpp/rules/functionerroneousreturnvaluenottested/FunctionErroneousReturnValueNotTested.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ query predicate problems(FunctionCall fc, string message) {
5656
"vsnwprintf_s"
5757
]) and
5858
not exists(GuardCondition gc |
59-
DataFlow::localFlow(DataFlow::exprNode(fc), DataFlow::exprNode(gc.getAChild*()))
59+
DataFlow::localFlow(DataFlow::exprNode(fc), DataFlow::exprNode(gc.(Expr).getAChild*()))
6060
) and
6161
message = "Return value from " + fc.getTarget().getName() + " is not tested for errors."
6262
}

0 commit comments

Comments
 (0)