Skip to content

Commit

Permalink
Another test case for issue willcrichton/flowistry#94
Browse files Browse the repository at this point in the history
  • Loading branch information
JustusAdam committed Feb 14, 2024
1 parent d9f6f20 commit 5c83934
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/paralegal-flow/tests/call-chain-analysis-tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,19 @@ fn no_overtaint_over_generic_fn_call() {
target(t.0);
another_target(t.1);
}

#[paralegal::analyze]
fn no_overtaint_over_nested_fn_call() {
let p = input();
let q = source();
forwarder((p, q));
}

fn forwarder(t: (usize, i32)) {
acceptor(t)
}

fn acceptor(t: (usize, i32)) {
target(t.0);
another_target(t.1);
}
22 changes: 22 additions & 0 deletions crates/paralegal-flow/tests/call_chain_analysis_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,25 @@ define_test!(no_overtaint_over_generic_fn_call
assert!(!dbg!(input.output()).flows_to_data(&dbg!(another_target.input())));
assert!(!another_input.output().flows_to_data(&target.input()));
});

define_test!(no_overtaint_over_nested_fn_call
skip
"Field level precision across function calls is broken.
See https://github.com/willcrichton/flowistry/issues/94."
: graph -> {
let input_fn = graph.function("input");
let input = graph.call_site(&input_fn);
let another_input_fn = graph.function("source");
let another_input = graph.call_site(&another_input_fn);

let target_fn = graph.function("target");
let target = graph.call_site(&target_fn);
let another_target_fn = graph.function("another_target");
let another_target = graph.call_site(&another_target_fn);

assert!(input.output().flows_to_data(&target.input()));
assert!(another_input.output().flows_to_data(&another_target.input()));
assert!(!dbg!(input.output()).flows_to_data(&dbg!(another_target.input())));
assert!(!another_input.output().flows_to_data(&target.input()));

});

0 comments on commit 5c83934

Please sign in to comment.