Skip to content

Commit ce8a84a

Browse files
authored
Merge pull request #12043 from jketema/subpaths
C++: Fix missing subpaths when displaying dataflow paths
2 parents 41ea71c + 24891c3 commit ce8a84a

File tree

6 files changed

+72
-20
lines changed

6 files changed

+72
-20
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,11 @@ class Unit extends TUnit {
692692
}
693693

694694
/** Holds if `n` should be hidden from path explanations. */
695-
predicate nodeIsHidden(Node n) { n instanceof OperandNode and not n instanceof ArgumentNode }
695+
predicate nodeIsHidden(Node n) {
696+
n instanceof OperandNode and
697+
not n instanceof ArgumentNode and
698+
not n.asOperand() instanceof StoreValueOperand
699+
}
696700

697701
class LambdaCallKind = Unit;
698702

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-359/semmle/tests/PrivateCleartextWrite.expected

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
edges
2+
| test.cpp:45:18:45:23 | buffer | test.cpp:45:7:45:10 | func indirection |
23
| test.cpp:57:9:57:18 | theZipcode | test.cpp:57:9:57:18 | theZipcode |
34
| test.cpp:57:9:57:18 | theZipcode | test.cpp:57:9:57:18 | theZipcode |
45
| test.cpp:57:9:57:18 | theZipcode | test.cpp:57:9:57:18 | theZipcode |
56
| test.cpp:74:24:74:30 | medical | test.cpp:78:24:78:27 | temp |
67
| test.cpp:74:24:74:30 | medical | test.cpp:81:22:81:28 | medical |
78
| test.cpp:77:16:77:22 | medical | test.cpp:78:24:78:27 | temp |
89
| test.cpp:77:16:77:22 | medical | test.cpp:81:22:81:28 | medical |
9-
| test.cpp:81:22:81:28 | medical | test.cpp:82:24:82:28 | buff5 |
10+
| test.cpp:81:17:81:20 | call to func | test.cpp:82:24:82:28 | buff5 |
11+
| test.cpp:81:22:81:28 | medical | test.cpp:45:18:45:23 | buffer |
12+
| test.cpp:81:22:81:28 | medical | test.cpp:81:17:81:20 | call to func |
1013
| test.cpp:96:37:96:46 | theZipcode | test.cpp:96:37:96:46 | theZipcode |
1114
| test.cpp:96:37:96:46 | theZipcode | test.cpp:96:37:96:46 | theZipcode |
1215
| test.cpp:96:37:96:46 | theZipcode | test.cpp:96:37:96:46 | theZipcode |
@@ -23,13 +26,16 @@ edges
2326
| test.cpp:99:61:99:70 | theZipcode | test.cpp:99:42:99:51 | theZipcode |
2427
| test.cpp:99:61:99:70 | theZipcode | test.cpp:99:42:99:51 | theZipcode |
2528
nodes
29+
| test.cpp:45:7:45:10 | func indirection | semmle.label | func indirection |
30+
| test.cpp:45:18:45:23 | buffer | semmle.label | buffer |
2631
| test.cpp:57:9:57:18 | theZipcode | semmle.label | theZipcode |
2732
| test.cpp:57:9:57:18 | theZipcode | semmle.label | theZipcode |
2833
| test.cpp:57:9:57:18 | theZipcode | semmle.label | theZipcode |
2934
| test.cpp:74:24:74:30 | medical | semmle.label | medical |
3035
| test.cpp:74:24:74:30 | medical | semmle.label | medical |
3136
| test.cpp:77:16:77:22 | medical | semmle.label | medical |
3237
| test.cpp:78:24:78:27 | temp | semmle.label | temp |
38+
| test.cpp:81:17:81:20 | call to func | semmle.label | call to func |
3339
| test.cpp:81:22:81:28 | medical | semmle.label | medical |
3440
| test.cpp:82:24:82:28 | buff5 | semmle.label | buff5 |
3541
| test.cpp:96:37:96:46 | theZipcode | semmle.label | theZipcode |
@@ -42,6 +48,7 @@ nodes
4248
| test.cpp:99:61:99:70 | theZipcode | semmle.label | theZipcode |
4349
| test.cpp:99:61:99:70 | theZipcode | semmle.label | theZipcode |
4450
subpaths
51+
| test.cpp:81:22:81:28 | medical | test.cpp:45:18:45:23 | buffer | test.cpp:45:7:45:10 | func indirection | test.cpp:81:17:81:20 | call to func |
4552
#select
4653
| test.cpp:57:9:57:18 | theZipcode | test.cpp:57:9:57:18 | theZipcode | test.cpp:57:9:57:18 | theZipcode | This write into the external location 'theZipcode' may contain unencrypted data from $@. | test.cpp:57:9:57:18 | theZipcode | this source of private data. |
4754
| test.cpp:57:9:57:18 | theZipcode | test.cpp:57:9:57:18 | theZipcode | test.cpp:57:9:57:18 | theZipcode | This write into the external location 'theZipcode' may contain unencrypted data from $@. | test.cpp:57:9:57:18 | theZipcode | this source of private data. |

0 commit comments

Comments
 (0)