Skip to content

Commit 23677b2

Browse files
authored
Merge pull request #15537 from MathiasVP/swap-also-clears-first-argument
C++: Also clear the `0`'th argument of `swap`
2 parents c5dc883 + 4b046ad commit 23677b2

File tree

2 files changed

+2
-2
lines changed
  • cpp/ql
    • lib/semmle/code/cpp/models/implementations
    • test/library-tests/dataflow/taint-tests

2 files changed

+2
-2
lines changed

cpp/ql/lib/semmle/code/cpp/models/implementations/Swap.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private class Swap extends DataFlowFunction, FlowOutBarrierFunction {
2020
output.isParameterDeref(0)
2121
}
2222

23-
override predicate isFlowOutBarrier(FunctionInput input) { input.isParameterDeref(1) }
23+
override predicate isFlowOutBarrier(FunctionInput input) { input.isParameterDeref([0, 1]) }
2424
}
2525

2626
/**

cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ void test_swap() {
212212

213213
std::swap(x, y);
214214

215-
sink(x); // $ SPURIOUS: ast,ir
215+
sink(x); // $ SPURIOUS: ast
216216
sink(y); // $ ast,ir
217217
}
218218

0 commit comments

Comments
 (0)