Skip to content

Commit 1124355

Browse files
committed
Rust: Add a test case for 'from_trusted_iterator' as sensitive data FP.
1 parent e5b4a15 commit 1124355

File tree

1 file changed

+15
-0
lines changed
  • rust/ql/test/library-tests/sensitivedata

1 file changed

+15
-0
lines changed

rust/ql/test/library-tests/sensitivedata/test.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,3 +345,18 @@ fn test_private_info(
345345

346346
sink(ContactDetails::FavouriteColor("blue".to_string()));
347347
}
348+
349+
struct MyArray {
350+
data: [i32; 10],
351+
}
352+
353+
impl MyArray {
354+
fn from_trusted_iterator(iter: impl Iterator<Item = i32>) -> Self {
355+
MyArray { data: [0; 10] }
356+
}
357+
}
358+
359+
fn test_iterator() {
360+
let iter = std::iter::repeat(1).take(10);
361+
sink(MyArray::from_trusted_iterator(iter)); // $ SPURIOUS: sensitive=secret
362+
}

0 commit comments

Comments
 (0)