Skip to content

Commit 69efe7a

Browse files
committed
C++: Add isAdditionalBarrier to DefaultTaintTracking.
1 parent 01b204e commit 69efe7a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,9 @@ module TaintedWithPath {
545545
/** Override this to specify which elements are sinks in this configuration. */
546546
abstract predicate isSink(Element e);
547547

548+
/** Override this to specify additional barriers in this configuration. */
549+
predicate isAdditionalBarrier(Expr node) { none() }
550+
548551
/**
549552
* Override this predicate to `any()` to allow taint to flow through global
550553
* variables.
@@ -578,7 +581,13 @@ module TaintedWithPath {
578581
)
579582
}
580583

581-
override predicate isBarrier(DataFlow::Node node) { nodeIsBarrier(node) }
584+
override predicate isBarrier(DataFlow::Node node) {
585+
nodeIsBarrier(node)
586+
or
587+
exists(TaintTrackingConfiguration cfg, Expr e |
588+
cfg.isAdditionalBarrier(e) and node = getNodeForExpr(e)
589+
)
590+
}
582591

583592
override predicate isBarrierIn(DataFlow::Node node) { nodeIsBarrierIn(node) }
584593
}

0 commit comments

Comments
 (0)