Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Control flow should propagate to "unconnected" call sites in inlined functions #83

Open
JustusAdam opened this issue Oct 11, 2023 · 0 comments
Labels
bug Something isn't working flow-analysis Concerns the PDG construction component

Comments

@JustusAdam
Copy link
Collaborator

JustusAdam commented Oct 11, 2023

The control flow connection of user_data and println! in this example is correctly captured.

fn fixed(user_data: &PrivateUserData) -> bool {
    if user_data.key.len() > 10 {
        println!("key is longer than 10!");
        return true;
    }
}

However a refactoring into a separate function looses the connection:

fn broken(user_data: &PrivateUserData) -> bool {
    if user_data.key.len() > 10 {
        return print_and_return_true();
    }
}

fn print_and_return_true() -> bool {
    println!("key is longer than 10!");
    return true;
}

I think this could be one of two reasons. Either the PDG we construct doesn’t contain any call sites with no edges (unlikely I think) or alternatively we forward propagate the control flow influences from caller to callee based on edges from the entry nodes instead of just all nodes. Yikes.

@JustusAdam JustusAdam added the flow-analysis Concerns the PDG construction component label Oct 12, 2023
@JustusAdam JustusAdam added the bug Something isn't working label Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flow-analysis Concerns the PDG construction component
Projects
None yet
Development

No branches or pull requests

1 participant