Rust: Add a test case for 'from_trusted_iterator' as sensitive data FP.

This commit is contained in:
Geoffrey White
2025-07-09 11:22:32 +01:00
parent e5b4a15e35
commit 1124355cdb

View File

@@ -345,3 +345,18 @@ fn test_private_info(
sink(ContactDetails::FavouriteColor("blue".to_string()));
}
struct MyArray {
data: [i32; 10],
}
impl MyArray {
fn from_trusted_iterator(iter: impl Iterator<Item = i32>) -> Self {
MyArray { data: [0; 10] }
}
}
fn test_iterator() {
let iter = std::iter::repeat(1).take(10);
sink(MyArray::from_trusted_iterator(iter)); // $ SPURIOUS: sensitive=secret
}