From 4b046ad67060d1467585276238fdcc3da2dfd5dd Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Wed, 7 Feb 2024 10:31:18 +0000 Subject: [PATCH] C++: Also clear the 0'th argument of 'swap'. --- cpp/ql/lib/semmle/code/cpp/models/implementations/Swap.qll | 2 +- cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/models/implementations/Swap.qll b/cpp/ql/lib/semmle/code/cpp/models/implementations/Swap.qll index 325fd6f58b2a..cb757800d65e 100644 --- a/cpp/ql/lib/semmle/code/cpp/models/implementations/Swap.qll +++ b/cpp/ql/lib/semmle/code/cpp/models/implementations/Swap.qll @@ -20,7 +20,7 @@ private class Swap extends DataFlowFunction, FlowOutBarrierFunction { output.isParameterDeref(0) } - override predicate isFlowOutBarrier(FunctionInput input) { input.isParameterDeref(1) } + override predicate isFlowOutBarrier(FunctionInput input) { input.isParameterDeref([0, 1]) } } /** diff --git a/cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp b/cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp index eeefa6dd427b..1ca4957b529b 100644 --- a/cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp +++ b/cpp/ql/test/library-tests/dataflow/taint-tests/taint.cpp @@ -212,7 +212,7 @@ void test_swap() { std::swap(x, y); - sink(x); // $ SPURIOUS: ast,ir + sink(x); // $ SPURIOUS: ast sink(y); // $ ast,ir }