mirror of
https://github.com/github/codeql.git
synced 2026-05-02 12:15:17 +02:00
C++: Make the 'definition by reference'-node in 'foo(a.b);' a source in the 'FieldConfiguration' configuration.
This commit is contained in:
@@ -735,7 +735,12 @@ private module FieldFlow {
|
||||
private class FieldConfiguration extends Configuration {
|
||||
FieldConfiguration() { this = "FieldConfiguration" }
|
||||
|
||||
override predicate isSource(Node source) { storeStep(source, _, _) }
|
||||
override predicate isSource(Node source) {
|
||||
storeStep(source, _, _)
|
||||
or
|
||||
// Also mark `foo(a.b);` as a source when `a.b` may be overwritten by `foo`.
|
||||
readStep(_, _, any(Node node | node.asExpr() = source.asDefiningArgument()))
|
||||
}
|
||||
|
||||
override predicate isSink(Node sink) { readStep(_, _, sink) }
|
||||
|
||||
|
||||
@@ -73,4 +73,5 @@
|
||||
| test.cpp:480:67:480:67 | s | test.cpp:481:21:481:21 | s |
|
||||
| test.cpp:480:67:480:67 | s | test.cpp:482:20:482:20 | s |
|
||||
| test.cpp:481:21:481:21 | s [post update] | test.cpp:482:20:482:20 | s |
|
||||
| test.cpp:481:24:481:30 | ref arg content | test.cpp:482:23:482:29 | content |
|
||||
| test.cpp:482:23:482:29 | content | test.cpp:483:9:483:17 | p_content |
|
||||
|
||||
Reference in New Issue
Block a user