Mathias Vorreiter Pedersen
251240376b
C++: Fix asPartialDefinition for IR dataflow nodes and accept testcases
2020-05-26 13:14:38 +02:00
Mathias Vorreiter Pedersen
c5c3ffaef0
C++: Add asPartialDefinition testcases
2020-05-26 13:14:11 +02:00
Mathias Vorreiter Pedersen
1c2b8563ae
C++: Remove 'flow' value from testcases
2020-05-14 15:33:02 +02:00
Mathias Vorreiter Pedersen
5f9b96cde9
C++: Fix off-by-one in test annotation
2020-05-14 15:12:00 +02:00
Mathias Vorreiter Pedersen
f414b277ba
C++: Modify complex.cpp test to account for longer access paths in the dataflow library
2020-05-14 13:58:04 +02:00
Mathias Vorreiter Pedersen
f5f3405ec3
C++: Modify IR field flow tests to use InlineExpectationsTest.qll
2020-05-14 11:11:21 +02:00
Mathias Vorreiter Pedersen
34314d0cb6
C++: Annotation field flow tests with [IR] and [AST]
2020-05-13 15:16:02 +02:00
Jonas Jensen
1018eaff09
Merge remote-tracking branch 'upstream/master' into dataflow-indirect-args
...
Conflicts:
cpp/ql/test/library-tests/dataflow/fields/ir-flow.expected
2020-05-13 12:05:58 +02:00
Mathias Vorreiter Pedersen
df6abdc074
Merge pull request #3389 from jbj/dataflow-defbyref-to-field
...
C++: Post-update flow through &, *, +, ...
2020-05-12 08:30:33 +02:00
Jonas Jensen
3a89f43cd6
Merge remote-tracking branch 'upstream/master' into dataflow-indirect-args
...
Conflicts:
cpp/ql/src/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll
cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/defaulttainttracking.cpp
cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/tainted.expected
cpp/ql/test/library-tests/dataflow/DefaultTaintTracking/test_diff.expected
cpp/ql/test/library-tests/dataflow/dataflow-tests/test_ir.expected
2020-05-11 14:44:17 +02:00
Mathias Vorreiter Pedersen
594f3b1807
C++: Add testcase for #3110
2020-05-07 14:39:53 +02:00
Jonas Jensen
1b1095ee75
C++: Post-update flow through &, *, +, ...
...
Flow from a definition by reference of a field into its object was
working inconsistently and in a very syntax-dependent way. For a
function `f` receiving a reference, `f(a->x)` could propagate data back
to `a` via the _reverse read_ mechanism in the shared data-flow library,
but for a function `g` receiving a pointer, `g(&a->x)` would not work.
And `f((*a).x)` would not work either.
In all cases, the issue was that the shared data-flow library propagates
data backwards between `PostUpdateNode`s only, but there is no
`PostUpdateNode` for `a->x` in `g(&a->x)`. This pull request inserts
such post-update nodes where appropriate and links them to their
neighbors. In this exapmle, flow back from the output parameter of `g`
passes first to the `PostUpdateNode` of `&`, then to the (new)
`PostUpdateNode` of `a->x`, and finally, as a _reverse read_ with the
appropriate field projection, to `a`.
2020-05-01 15:40:19 +02:00
Jonas Jensen
5f74c24d4d
C++: Test definitions through &, *, ...
2020-05-01 11:04:49 +02:00
Jonas Jensen
4ddf12119d
C++: Don't suppress consistency checks for calls
...
See https://github.com/github/codeql/pull/3162#discussion_r400849713 .
2020-05-01 11:04:42 +02:00
Mathias Vorreiter Pedersen
a6e619ce5b
C++: Add field flow through single-field structs and accept tests
2020-04-20 08:52:46 +02:00
Mathias Vorreiter Pedersen
6fca23bc8b
C++: Demonstrate lack of flow through single-field structs
2020-04-20 08:50:31 +02:00
Mathias Vorreiter Pedersen
f02feac33a
C++: Add flow from #3220
2020-04-15 11:34:19 +02:00
Mathias Vorreiter Pedersen
cde34c9b1b
C++: Accept test output which I previously forgot to accept
2020-04-13 16:19:21 +02:00
Mathias Vorreiter Pedersen
5719967a8e
C++: Remove single-field case from PostUpdateNode and accept tests
2020-04-07 12:03:28 +02:00
Mathias Vorreiter Pedersen
c577541850
C++: Fix reverse read dataflow consistency failure and accept tests
2020-04-06 15:50:08 +02:00
Mathias Vorreiter Pedersen
317734f41e
C++: Attach PostUpdateNodes to Chi nodes following aschackmull's suggestion
2020-04-05 22:35:26 +02:00
Mathias Vorreiter Pedersen
020c273dc9
Merge branch 'master' into ir-flow-fields
2020-04-02 10:45:58 +02:00
Jonas Jensen
531ef64c5d
C++: Fix other copies of the argHasPostUpdate test
2020-03-30 17:45:53 +02:00
Mathias Vorreiter Pedersen
5ba5791ec6
C++: Only allow flow through non-conflated chi instructions
2020-03-27 13:37:17 +01:00
Mathias Vorreiter Pedersen
c6c613840a
C++: Removed toString from PostUpdateNodes. They were more confusing than helpful
2020-03-26 11:43:40 +01:00
Mathias Vorreiter Pedersen
fbef146a49
C++: Remove PositionalArgumentWithoutWriteSideEffectNode (since not all arguments need a PostUpdateNode). Also generalized the added flow rule in simpleLocalFlowStep since there isn't always a ChiInstruction - for instance of it's a write to a struct that only has a single field.
2020-03-26 11:39:20 +01:00
Mathias Vorreiter Pedersen
077c282cd3
C++: Add field flow and accept tests
2020-03-24 22:28:54 +01:00
Mathias Vorreiter Pedersen
22381f3ee6
C++: Demonstrate amount of field flow already present
2020-03-24 22:28:54 +01:00
Anders Schack-Mulligen
85d6b7c2ed
C++: Add tests.
2020-03-11 10:49:21 +01:00
Anders Schack-Mulligen
96e4a57edd
C++: Autoformat.
2020-01-29 13:11:50 +01:00
Mathias Vorreiter Pedersen
1d3ee71f73
C++: Added test for 333d0a69
2019-12-17 13:54:41 +01:00
Jonas Jensen
c41114334f
Merge remote-tracking branch 'upstream/master' into ir-dataflow-toString
...
Solved conflicts in `*.expected` by re-running the tests.
2019-11-19 14:27:27 +01:00
Jonas Jensen
7c319efb8b
C++: Data flow through reference parameters
2019-10-01 10:43:49 +02:00
Jonas Jensen
b2df18ab78
C++: Document tests better
...
This addresses PR comments by @rdmarsh2.
2019-09-17 13:17:25 +02:00
Jonas Jensen
ef601cf78e
C++: Annotate changes in struct_init.c test
2019-09-17 13:16:36 +02:00
Jonas Jensen
fd6d06fe6f
C++: Data flow through address-of operator (&)
...
The data flow library conflates pointers and their objects in some
places but not others. For example, a member function call `x.f()` will
cause flow from `x` of type `T` to `this` of type `T*` inside `f`. It
might be ideal to avoid that conflation, but that's not realistic
without using the IR.
We've had good experience in the taint tracking library with conflating
pointers and objects, and it improves results for field flow, so perhaps
it's time to try it out for all data flow.
2019-09-17 13:16:34 +02:00
Jonas Jensen
562bffe710
C++: Simplify toString of ImplicitParameterNode
...
This string looked out of place compared to `ExplicitParameterNode`,
whose string is simply the name of the parameter and therefore
indistinguishable from an access to the parameter without looking at the
location also. This has not been a problem so far, and if we want to
distinguish more clearly between initial values and accesses at some
point, we should do it for `ExplicitParameterNode` and
`UninitializedNode` too.
2019-09-13 14:33:26 +02:00
Anders Schack-Mulligen
61e4e61087
C++: Adjust qltest expected output.
2019-09-12 11:00:49 +02:00
Geoffrey White
22e1715368
Merge pull request #1900 from jbj/dataflow-this-by-ref
...
C++: Fix flow out of `this` by reference
2019-09-09 11:15:32 +01:00
Jonas Jensen
ea3d066661
C++: Add D.cpp, ported from D.java
...
The original port of the Java field-flow tests did not include this
file. It's added here for completeness, and the results are the same as
for Java.
2019-09-09 10:45:06 +02:00
Jonas Jensen
10b69358ae
C++: Fix flow from this by ref.
2019-09-09 10:36:58 +02:00
Jonas Jensen
08b63d4342
C++: Test to show lack of flow from this by ref.
...
The `test_nonMemberSetA` also shows how the lack of flow through `&` is
a problem for non-member getters, but that's addressed on a separate
branch.
2019-09-09 10:36:11 +02:00
Jonas Jensen
d51e5212fb
Merge remote-tracking branch 'upstream/master' into dataflow-TTwo
...
Conflicts:
cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll
cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll
cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll
cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImpl4.qll
cpp/ql/src/semmle/code/cpp/dataflow/internal/DataFlowImplLocal.qll
cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll
cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll
cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll
cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll
cpp/ql/test/library-tests/dataflow/fields/flow.expected
csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll
csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll
csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll
csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll
csharp/ql/src/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll
java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll
java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll
java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl3.qll
java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl4.qll
java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl5.qll
2019-09-08 21:08:43 +02:00
Jonas Jensen
114c2fe0d4
Merge remote-tracking branch 'upstream/master' into ast-field-flow-defbyref
2019-09-05 09:33:45 +02:00
Jonas Jensen
8579d7d1cf
C++: Tests for aliasing of nested structs
...
This test shows that local pointers into structs do propagate data flow
like pass-by-reference does in calls.
2019-09-04 10:26:49 +02:00
Jonas Jensen
067c55adb9
C++: Fix ConditionDeclExpr data flow
...
Data flow probably never worked when a variable declared in a
`ConditionDeclExpr` was modeled with `BlockVar`. That combination did
not come up in testing before the last commit.
2019-09-04 09:33:00 +02:00
Jonas Jensen
d7681bf122
C++: Don't use definitionByReference for data flow
...
The data flow library conflates pointers and objects enough for the
`definitionByReference` predicate to be too strict in some cases. It was
too permissive in other cases that are now (or will be) handled better
by field flow.
See also the change note entry.
2019-09-03 11:49:01 +02:00
Jonas Jensen
d3a6ae5657
C++: Support nested field flow
...
This is the C/C++ side of PR #1766 .
2019-09-03 08:50:15 +02:00
Jonas Jensen
b1be123e31
C#/C++/Java: Prettier AccessPath.toString
...
The `ppReprType` predicate should now be `none()` instead of `result=""`
to signal that there is nothing to print. That seems clearer to me.
2019-09-02 13:14:20 +02:00
Jonas Jensen
9f0f2f7c04
C++: Accept test changes
2019-09-02 13:14:17 +02:00