Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bdb67c

Browse files
committed
C++: Allow member variables to be picked as input nodes.
1 parent 4eae191 commit 8bdb67c

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

cpp/ql/lib/semmle/code/cpp/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ module SourceSinkInterpretationInput implements
166166
c = "" and
167167
e.getQualifier() = n.asExpr()
168168
or
169-
// Allow variables (without a qualifier) to be picked as input nodes.
169+
// Allow variables to be picked as input nodes.
170170
// We could simply do this as `e = n.asExpr()`, but that would not allow
171171
// us to pick `x` as a sink in an example such as `x = source()` (but
172172
// only subsequent uses of `x`) since the variable access on `x` doesn't
@@ -175,7 +175,6 @@ module SourceSinkInterpretationInput implements
175175
// expression associated with the destination instruction. This means
176176
// that the `x` in `x = source()` can be marked as an input.
177177
c = "" and
178-
not exists(e.getQualifier()) and
179178
exists(StoreInstruction store |
180179
store.getDestinationAddress().getUnconvertedResultExpression() = e and
181180
n.asInstruction() = store

cpp/ql/test/library-tests/dataflow/models-as-data/tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ void test_class_members() {
239239

240240
mc.memberMadSinkArg0(source()); // $ ir
241241

242-
mc.memberMadSinkVar = source(); // $ MISSING: ir
242+
mc.memberMadSinkVar = source(); // $ ir
243243

244244
mnc.namespaceMemberMadSinkArg0(source()); // $ ir
245245
MyNamespace::MyClass::namespaceStaticMemberMadSinkArg0(source()); // $ ir
246-
mnc.namespaceMemberMadSinkVar = source(); // $ MISSING: ir
246+
mnc.namespaceMemberMadSinkVar = source(); // $ ir
247247
MyNamespace::MyClass::namespaceStaticMemberMadSinkVar = source(); // $ ir
248248

249249
// test class member summaries

0 commit comments

Comments
 (0)