Skip to content

Commit d2cfd53

Browse files
committed
Rust: Add test with wrong generated model
1 parent 2824c98 commit d2cfd53

File tree

3 files changed

+723
-672
lines changed

3 files changed

+723
-672
lines changed

rust/ql/test/library-tests/dataflow/models/main.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ enum MyPosEnum {
3131
B(i64),
3232
}
3333

34+
// has a manual flow model with flow from second argument to the return value
35+
// and a wrong generated model with flow from first argument to the return value
36+
fn snd(a: i64, b: i64) -> i64 {
37+
0
38+
}
39+
40+
fn test_snd() {
41+
let s1 = source(99);
42+
sink(snd(0, s1)); // $ hasValueFlow=99
43+
44+
let s2 = source(88);
45+
sink(snd(s2, 0)); // $ SPURIOUS: hasValueFlow=88
46+
}
47+
3448
// has a flow model
3549
fn get_var_pos(e: MyPosEnum) -> i64 {
3650
0

0 commit comments

Comments
 (0)