Skip to content

Commit a2de057

Browse files
committed
C++: Test for StmtExpr data flow
1 parent 9d595aa commit a2de057

File tree

1 file changed

+17
-0
lines changed
  • cpp/ql/test/library-tests/dataflow/dataflow-tests

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,3 +491,20 @@ void intArraySourceCaller2() {
491491
sink(local); // tainted
492492
sink(*local); // clean
493493
}
494+
495+
///////////////////////////////////////////////////////////////////////////////
496+
497+
void throughStmtExpr(int source1, int clean1) {
498+
sink( ({ source1; }) ); // tainted (FALSE NEGATIVE)
499+
sink( ({ clean1; }) ); // clean
500+
501+
int local = ({
502+
int tmp;
503+
if (clean1)
504+
tmp = source1;
505+
else
506+
tmp = clean1;
507+
tmp;
508+
});
509+
sink(local); // tainted (FALSE NEGATIVE)
510+
}

0 commit comments

Comments
 (0)