-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18144 from paldepind/rust-df-inconsistency-no-loc…
…ation Rust: Exclude data flow inconsistencies that stem from other inconsis…
- Loading branch information
Showing
8 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 | |