Skip to content

Commit c598b26

Browse files
committed
check FnPtrCreation effects against any available sinks
1 parent 6aee16d commit c598b26

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/scanner.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,9 @@ where
11701170
// the function the pointer points to has potential
11711171
// effects itself at the end of the scan
11721172
if matches!(eff_type, Effect::FnPtrCreation) {
1173-
self.data.fn_ptr_effects.push(eff);
1173+
if self.sinks.is_empty() || self.sinks.contains(callee.as_path()) {
1174+
self.data.fn_ptr_effects.push(eff);
1175+
}
11741176
} else {
11751177
self.data.effects.push(eff);
11761178
self.data.fns_with_effects.insert(caller.clone());
@@ -1435,7 +1437,7 @@ pub fn scan_crate_with_sinks(
14351437
scan_results
14361438
.effects
14371439
.retain(|e| EffectType::matches_effect(relevant_effects, e.eff_type()));
1438-
1440+
14391441
Ok(scan_results)
14401442
}
14411443

0 commit comments

Comments
 (0)