File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
rust/ql/test/library-tests/dataflow/taint Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 1+ import codeql.rust.dataflow.DataFlow
2+ import codeql.rust.dataflow.internal.TaintTrackingImpl
3+
4+ query predicate additionalTaintStep = RustTaintTracking:: defaultAdditionalTaintStep / 3 ;
Original file line number Diff line number Diff line change @@ -24,8 +24,27 @@ fn cast() {
2424 sink ( b as i64 ) ; // $ MISSING: hasTaintFlow=77
2525}
2626
27+ mod string {
28+ fn source ( i : i64 ) -> String {
29+ format ! ( "{}" , i)
30+ }
31+
32+ fn sink ( s : & str ) {
33+ println ! ( "{}" , s) ;
34+ }
35+
36+ pub fn string_slice ( ) {
37+ let s = source ( 35 ) ;
38+ let sliced = & s[ 1 ..3 ] ;
39+ sink ( sliced) ; // $ MISSING: hasTaintFlow=35
40+ }
41+ }
42+
43+ use string:: * ;
44+
2745fn main ( ) {
2846 addition ( ) ;
2947 negation ( ) ;
3048 cast ( ) ;
49+ string_slice ( ) ;
3150}
You can’t perform that action at this time.
0 commit comments