-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Description
I find a false negative about the Unsafe Dataflow detection in Rudra. In the following code example, Rudra reports a warning at line 4. However, when I replace the for item in iter (line 4) with for item in iter.skip(1) (line 5), the warning disappears.
use std::fmt::Debug;
fn func<I: Iterator<Item = impl Debug>>(iter: I) {
let non_copy = Box::new(1234);
for item in iter { // Reports a true Unsafe Dataflow warning
// for item in iter.skip(1) { // Reports no warnings if we replace the loop statement
unsafe { std::ptr::read(&non_copy); }
}
}
pub fn main() {
func(0..10);
}Expected Behavior
Rudra should also report a warning when we usefor item in iter.skip(1) loop instead.
Actual Behavior
Rudra reports an unsafe dataflow warning when the loop for item in iter is used, but reports no warnings when the iter.skip(1) loop statement is used instead.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels