File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed
cpp/ql/test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ void test_myint_member_assignment()
5353
5454 mi.i = source ();
5555
56- sink (mi); // $ MISSING: ast,ir
56+ sink (mi); // $ ir MISSING: ast
5757 sink (mi.get ()); // $ ast,ir
5858}
5959
@@ -63,7 +63,7 @@ void test_myint_method_assignment()
6363
6464 mi.get () = source ();
6565
66- sink (mi); // $ MISSING: ast,ir
66+ sink (mi); // $ ir MISSING: ast
6767 sink (mi.get ()); // $ ast,ir
6868}
6969
Original file line number Diff line number Diff line change @@ -28,12 +28,12 @@ void test_pair()
2828 b.first = source ();
2929 sink (b.first ); // $ ast,ir
3030 sink (b.second );
31- sink (b); // $ MISSING: ast,ir
31+ sink (b); // $ ir MISSING: ast
3232
3333 c.second = source ();
3434 sink (c.first );
3535 sink (c.second ); // $ ast,ir
36- sink (c); // $ MISSING: ast,ir
36+ sink (c); // $ ir MISSING: ast
3737
3838 std::pair<char *, char *> d (" 123" , " 456" );
3939 sink (d.first );
@@ -43,7 +43,7 @@ void test_pair()
4343 std::pair<char *, char *> e (source (), " 456" );
4444 sink (e.first ); // $ ast,ir
4545 sink (e.second );
46- sink (e); // $ MISSING: ast,ir
46+ sink (e); // $ ir MISSING: ast
4747
4848 std::pair<char *, char *> f (" 123" , source ());
4949 sink (f.first );
Original file line number Diff line number Diff line change @@ -448,9 +448,9 @@ void test_qualifiers()
448448 sink (b);
449449 sink (b.getMember ());
450450 b.member = source ();
451- sink (b); // $ MISSING: ast,ir
451+ sink (b); // $ ir MISSING: ast
452452 sink (b.member ); // $ ast,ir
453- sink (b.getMember ()); // $ MISSING: ast,ir
453+ sink (b.getMember ()); // $ ir MISSING: ast
454454
455455 c = new MyClass2 (0 );
456456
@@ -690,7 +690,7 @@ void test_argument_source_field_to_obj() {
690690 two_members s;
691691 argument_source (s.x );
692692
693- sink (s); // $ SPURIOUS: ast
693+ sink (s); // $ SPURIOUS: ast,ir
694694 sink (s.x ); // $ ast,ir
695695 sink (s.y ); // clean
696696}
Original file line number Diff line number Diff line change @@ -102,5 +102,11 @@ module IRTest {
102102 override predicate isSanitizer ( DataFlow:: Node barrier ) {
103103 barrier .asExpr ( ) .( VariableAccess ) .getTarget ( ) .hasName ( "sanitizer" )
104104 }
105+
106+ override predicate allowImplicitRead ( DataFlow:: Node node , DataFlow:: ContentSet c ) {
107+ // allow arbitrary reads at sinks
108+ isSink ( node ) and
109+ c .( DataFlow:: FieldContent ) .getField ( ) .getDeclaringType ( ) = node .getType ( ) .getUnspecifiedType ( )
110+ }
105111 }
106112}
You can’t perform that action at this time.
0 commit comments