Skip to content

C++: Add a test of TOCTOUFilesystemRace.ql #3432

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

Merged
merged 2 commits into from
May 11, 2020
Merged

Conversation

geoffw0
Copy link
Contributor

@geoffw0 geoffw0 commented May 7, 2020

Add a test of TOCTOUFilesystemRace.ql, which somehow didn't have a test in this repo. The test is inspired by the recent regression in CPP-Differences, and I've included results both before and after #3382 which caused the difference.

On reflection though I don't actually think this is a regression - just a more cautious approach that's finding fewer correct results as well as fewer false positives. We could probably get more accurate results by converting this query to use a proper dataflow library.

@geoffw0 geoffw0 added the C++ label May 7, 2020
@geoffw0 geoffw0 requested a review from a team as a code owner May 7, 2020 18:08
Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for investigating! I agree with your conclusions.

@jbj jbj merged commit 8ff045b into github:master May 11, 2020
jbj added a commit to jbj/ql that referenced this pull request May 11, 2020
After github#3382 changed the escape analysis to model qualifiers as escaping,
there was an imbalance in the SSA library, where `addressTakenVariable`
excludes variables from SSA analysis if they have their address taken
but are _not_ passed by reference. This showed up as a missing result in
`TOCTOUFilesystemRace.ql`, demonstrated with a test case in github#3432.

This commit changes the definition of "pass by reference" to include
call qualifiers, which allows SSA modeling of variables that have member
function calls on them.
This was referenced May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants