@@ -22,15 +22,28 @@ import codingstandards.c.cert
22
22
import codingstandards.cpp.ConcurrencyNew
23
23
import semmle.code.cpp.dataflow.new.DataFlow
24
24
25
+ newtype Direction =
26
+ Incoming ( ) or
27
+ Outgoing ( )
28
+
29
+ predicate isSource ( DataFlow:: Node node , Direction d ) {
30
+ exists ( TSSCreateFunctionCall tsc , Expr e |
31
+ // the only requirement of the source is that at some point
32
+ // it refers to the key of a create statement
33
+ e .getParent * ( ) = tsc .getKey ( )
34
+ |
35
+ d = Outgoing ( ) and
36
+ e = [ node .asExpr ( ) , node .asDefiningArgument ( ) ]
37
+ or
38
+ d = Incoming ( ) and
39
+ e = [ node .asExpr ( ) , node .asIndirectArgument ( ) ]
40
+ )
41
+ }
42
+
25
43
module TssCreateToTssDeleteConfig implements DataFlow:: ConfigSig {
26
- predicate isSource ( DataFlow:: Node node ) {
27
- exists ( TSSCreateFunctionCall tsc , Expr e |
28
- // the only requirement of the source is that at some point
29
- // it refers to the key of a create statement
30
- e .getParent * ( ) = tsc .getKey ( ) and
31
- ( e = node .asDefiningArgument ( ) or e = node .asExpr ( ) )
32
- )
33
- }
44
+ predicate isSource ( DataFlow:: Node node ) { isSource ( node , Outgoing ( ) ) }
45
+
46
+ predicate isBarrierIn ( DataFlow:: Node node ) { isSource ( node , Incoming ( ) ) }
34
47
35
48
predicate isSink ( DataFlow:: Node node ) {
36
49
exists ( TSSDeleteFunctionCall tsd , Expr e |
0 commit comments