Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3653627

Browse files
committed
C++: Let configuration class extend singleton
1 parent 207c76b commit 3653627

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,21 @@ Function resolveCall(Call call) {
394394
* taint paths.
395395
*/
396396
module TaintedWithPath {
397+
private newtype TSingleton = MkSingleton()
398+
397399
/**
398400
* A taint-tracking configuration that matches sources and sinks in the same
399401
* way as the `tainted` predicate.
402+
*
403+
* Override `isSink` and `taintThroughGlobals` as needed, but do not provide
404+
* a characteristic predicate.
400405
*/
401-
class TaintTrackingConfiguration extends int {
402-
TaintTrackingConfiguration() { this = 1 }
403-
406+
class TaintTrackingConfiguration extends TSingleton {
404407
/** Override this to specify which elements are sinks in this configuration. */
405408
abstract predicate isSink(Element e);
409+
410+
/** Gets a textual representation of this element. */
411+
string toString() { result = "TaintTrackingConfiguration" }
406412
}
407413

408414
private class AdjustedConfiguration extends DataFlow3::Configuration {

0 commit comments

Comments
 (0)