Skip to content

Commit 1d461ff

Browse files
committed
Rust: Test unpacking the Wrapping number.
1 parent ff6e598 commit 1d461ff

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

rust/ql/test/library-tests/dataflow/taint/TaintFlowStep.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@
5252
| main.rs:197:9:197:9 | [post] a [implicit borrow] | main.rs:197:9:197:9 | [post] a |
5353
| main.rs:198:9:198:9 | [post] a [implicit borrow] | main.rs:198:9:198:9 | [SSA] a |
5454
| main.rs:199:9:199:9 | [post] a [implicit borrow] | main.rs:199:9:199:9 | [SSA] a |
55+
| main.rs:201:21:201:21 | a | main.rs:201:21:201:23 | a.0 |

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,13 @@ mod wrapping {
192192
}
193193

194194
pub fn wrapping() {
195-
let mut a: Wrapping<i64> = Wrapping(1);
195+
let mut a: Wrapping<i64> = Wrapping(crate::source(1));
196196
a.add_assign(source(2));
197197
a.add_assign(Wrapping(crate::source(3)));
198198
a += source(4);
199199
a += std::num::Wrapping(crate::source(5));
200-
sink(a); // $ hasTaintFlow=2 hasTaintFlow=4 MISSING: hasTaintFlow=3 hasTaintFlow=5 --- we don't currently find any `Call`s for `Wrapping` above
200+
sink(a); // $ hasTaintFlow=2 hasTaintFlow=4 MISSING: hasTaintFlow=1 hasTaintFlow=3 hasTaintFlow=5
201+
crate::sink(a.0); // $ MISSING: hasTaintFlow=1 hasTaintFlow=2 hasTaintFlow=3 hasTaintFlow=4 hasTaintFlow=5
201202
}
202203
}
203204

0 commit comments

Comments
 (0)