Skip to content

Commit 72df4d5

Browse files
committed
C++: Fix queries after github/codeql#23288.
1 parent 01f2aa5 commit 72df4d5

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

‎cpp/autosar/src/rules/A7-5-1/InvalidFunctionReturnType.ql‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ import cpp
1818
import codingstandards.cpp.autosar
1919
import semmle.code.cpp.dataflow.new.DataFlow
2020

21-
from Parameter p, ReturnStmt ret
21+
from Parameter p, ReturnStmt ret, DataFlow::Node n
2222
where
2323
not isExcluded(p, FunctionsPackage::invalidFunctionReturnTypeQuery()) and
2424
p.getUnderlyingType().isDeeplyConst() and
2525
p.getType() instanceof DerivedType and
2626
p.getFunction().getType().stripTopLevelSpecifiers() instanceof DerivedType and
27-
DataFlow::localFlow(DataFlow::parameterNode(p), DataFlow::exprNode(ret.getExpr()))
27+
n.asParameter(0) = p and
28+
DataFlow::localFlow(n, DataFlow::exprNode(ret.getExpr()))
2829
select ret,
2930
"Function " + p.getFunction().getName() +
3031
" returns a reference or a pointer to $@ that is passed by reference to const.", p, "parameter"

‎cpp/common/src/codingstandards/cpp/rules/stringnumberconversionmissingerrorcheck/StringNumberConversionMissingErrorCheck.qll‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ class StreamErrorStateCheck extends FunctionCall {
9191
checkedArg = this.(StreamErrorStateCheckDirectCall).getACheckedStream()
9292
or
9393
// Or a wrapper around an existing `StreamErrorStateCheck`
94-
exists(Function wrapper, int param, StreamErrorStateCheck wrappedErrorCheck |
94+
exists(Function wrapper, int param, StreamErrorStateCheck wrappedErrorCheck, DataFlow::Node n |
9595
getTarget() = wrapper and
96-
DataFlow::localFlow(DataFlow::parameterNode(wrapper.getParameter(param)),
97-
DataFlow::exprNode(wrappedErrorCheck.getACheckedStream())) and
96+
n.asParameter(0) = wrapper.getParameter(param) and
97+
DataFlow::localFlow(n, DataFlow::exprNode(wrappedErrorCheck.getACheckedStream())) and
9898
checkedArg = getArgument(param)
9999
)
100100
}

0 commit comments

Comments
 (0)