-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rust: Exclude data flow inconsistencies that stem from other inconsis… #18144
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
paldepind
merged 3 commits into
github:main
from
paldepind:rust-df-inconsistency-no-location
Dec 2, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
rust/ql/lib/codeql/rust/dataflow/internal/DataFlowConsistency.qll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import codeql.rust.dataflow.DataFlow::DataFlow as DataFlow | ||
| private import rust | ||
| private import codeql.rust.dataflow.internal.DataFlowImpl | ||
| private import codeql.rust.dataflow.internal.TaintTrackingImpl | ||
| private import codeql.dataflow.internal.DataFlowImplConsistency | ||
|
|
||
| private module Input implements InputSig<Location, RustDataFlow> { | ||
| predicate uniqueNodeLocationExclude(RustDataFlow::Node n) { | ||
| // Exclude nodes where the missing location can be explained by the | ||
| // underlying AST node not having a location. | ||
| not exists(n.asExpr().getLocation()) | ||
| } | ||
|
|
||
| predicate missingLocationExclude(RustDataFlow::Node n) { not exists(n.asExpr().getLocation()) } | ||
| } | ||
|
|
||
| import MakeConsistency<Location, RustDataFlow, RustTaintTracking, Input> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
rust/ql/test/extractor-tests/generated/MacroItems/CONSISTENCY/AstConsistency.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| noLocation | ||
| | file://:0:0:0:0 | ... .parent(...) | | ||
| | file://:0:0:0:0 | ... .unwrap(...) | | ||
| | file://:0:0:0:0 | ...: ... | | ||
| | file://:0:0:0:0 | ...::Path | | ||
| | file://:0:0:0:0 | ...::path | | ||
| | file://:0:0:0:0 | ArgList | | ||
| | file://:0:0:0:0 | ArgList | | ||
| | file://:0:0:0:0 | MacroItems | | ||
| | file://:0:0:0:0 | ParamList | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | Path | | ||
| | file://:0:0:0:0 | RefType | | ||
| | file://:0:0:0:0 | RefType | | ||
| | file://:0:0:0:0 | RetType | | ||
| | file://:0:0:0:0 | StmtList | | ||
| | file://:0:0:0:0 | Use | | ||
| | file://:0:0:0:0 | UseTree | | ||
| | file://:0:0:0:0 | fn get_parent | | ||
| | file://:0:0:0:0 | get_parent | | ||
| | file://:0:0:0:0 | parent | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | path | | ||
| | file://:0:0:0:0 | std | | ||
| | file://:0:0:0:0 | std | | ||
| | file://:0:0:0:0 | std | | ||
| | file://:0:0:0:0 | unwrap | | ||
| | file://:0:0:0:0 | { ... } | |
11 changes: 0 additions & 11 deletions
11
rust/ql/test/extractor-tests/generated/MacroItems/CONSISTENCY/DataFlowConsistency.expected
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| | Multiple parents | 0 | | ||
| | Multiple primary QL classes | 0 | | ||
| | Multiple toStrings | 0 | | ||
| | No location | 0 | | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this file has got rid of some needless duplication. 👍