Skip to content

Commit 4b046ad

Browse files
committed
C++: Also clear the 0'th argument of 'swap'.
1 parent c5dc883 commit 4b046ad

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)