Mathias Vorreiter Pedersen
7fdea27d33
C++: Rename 'IndirectTemporaryExpr' to 'IndirectOperandExprNode'.
2024-03-14 11:46:15 +00:00
Mathias Vorreiter Pedersen
dacf7d73d9
Merge pull request #15918 from MathiasVP/fix-as-expr-for-temps
...
C++: Fix dataflow node <> expression problem on prvalues
2024-03-14 09:38:46 +00:00
Mathias Vorreiter Pedersen
a24432bacc
Update cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
2024-03-14 09:23:33 +00:00
Mathias Vorreiter Pedersen
c375497fa5
Update cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
2024-03-14 09:16:04 +00:00
Mathias Vorreiter Pedersen
a839c92979
C++: Fix mapping issue between dataflow nodes and expressions when the expression is a prvalue.
2024-03-13 22:59:09 +00:00
Jeroen Ketema
866a3934d4
C++: suppress destructors with reuse expressions until proper support is added
2024-03-13 20:17:00 +01:00
Jeroen Ketema
67b3670d06
Merge pull request #15901 from jketema/destructors11
...
C++: Introduce re-use expressions in the database scheme
2024-03-13 18:27:28 +01:00
Jeroen Ketema
8d5eab401d
C++: Introduce re-use expressions in the database scheme
2024-03-13 13:28:27 +01:00
Mathias Vorreiter Pedersen
bcd36b1994
C++: Recognize glib allocations and deallocations.
2024-03-13 11:39:15 +00:00
Tom Hvitved
dddba3228b
Merge pull request #15867 from hvitved/dataflow/ap-limit
...
Data flow: Add `ConfigSig::accessPathLimit`
2024-03-12 14:57:51 +01:00
Tom Hvitved
da66281fef
Sync files
2024-03-11 13:02:04 +01:00
Mathias Vorreiter Pedersen
cf162aa412
C++: Add an explicit definition of the address of an IRVariable.
2024-03-06 18:18:33 -08:00
Mathias Vorreiter Pedersen
84797b9091
C++: Refactor the address out of 'DefImpl' and into a new abstract class 'OperandBasedDef'.
2024-03-06 18:15:52 -08:00
Jeroen Ketema
66d2a8499d
Merge pull request #15816 from MathiasVP/remove-ssa-pruning-stage
...
C++: Remove the pruning stage from dataflow SSA
2024-03-06 11:04:05 +01:00
Robert Marsh
fbbd57b34f
C++: Suppress epxr destructors in preparation for temporaries
2024-03-05 21:12:12 +00:00
Mathias Vorreiter Pedersen
f400228037
C++: Remove the pruning stage from SSA.
2024-03-05 12:55:55 -08:00
Robert Marsh
28e1e3a13a
C++: remove skeleton for IR destructors on expressions
2024-03-04 21:54:18 +00:00
Mathias Vorreiter Pedersen
4474b54662
C++: Add more QLDoc.
2024-02-29 12:09:50 +00:00
Mathias Vorreiter Pedersen
46b47db78e
C++: Rename IPA branch.
2024-02-29 12:02:13 +00:00
Mathias Vorreiter Pedersen
a7f0966fcb
C++: Restrict 'VariableNode's to only be global-like variables (which is the only place where use them for).
2024-02-28 19:12:38 +00:00
Mathias Vorreiter Pedersen
ddd5113c02
C++: Ensure that we can construct an 'IRType' from a 'RoutineType'.
2024-02-27 17:58:52 +00:00
Mathias Vorreiter Pedersen
bba152da13
Merge branch 'main' into ir-for-vacuous-destructor-calls
2024-02-27 15:42:46 +00:00
Mathias Vorreiter Pedersen
f7b2de800b
Merge pull request #15506 from rdmarsh2/rdmarsh2/cpp/ir-synthetic-destructors
...
C++: Add implicit destructors for named variables to the IR
2024-02-27 15:12:46 +00:00
Mathias Vorreiter Pedersen
9eaa4e19ad
C++: Add IR construction for vacuous destructor calls.
2024-02-27 13:53:42 +00:00
Robert Marsh
a513598a4d
C++: Change note for IR named destructors.
2024-02-26 19:41:56 +00:00
Geoffrey White
408a550467
Merge pull request #15727 from geoffw0/qldoc4
...
C++: Mark internal files in the old dataflow library as deprecated
2024-02-26 17:45:05 +00:00
Geoffrey White
2e66392353
C++: Update deprecated note to respect identical files.
2024-02-26 16:38:27 +00:00
Geoffrey White
5c4543f167
C++: Mark internal files in the old dataflow library as deprecated (the public imports already are).
2024-02-26 14:49:10 +00:00
Robert Marsh
da5e3d64ac
C++: autoformat
2024-02-23 16:20:42 +00:00
Robert Marsh
dd97584eff
C++: fix for duplicated parent of ReturnVoid statements
2024-02-23 16:19:34 +00:00
Tom Hvitved
62b16c0fa3
Share getFileBySourceArchiveName implementation
2024-02-23 11:25:49 +01:00
Robert Marsh
6f7f68fee8
Merge branch 'main' into rdmarsh2/cpp/ir-synthetic-destructors
2024-02-22 18:10:13 +00:00
Robert Marsh
942a4ed925
C++: move handlesDestructorsExplicitly up to TranslatedReturnStmt
2024-02-22 16:46:19 +00:00
Mathias Vorreiter Pedersen
0bf29f0a62
Merge branch 'main' into model-experiments
2024-02-22 15:05:53 +00:00
Mathias Vorreiter Pedersen
350d5bf0ce
C++: Update QLDoc on 'modeledFlowBarrier'.
2024-02-22 13:30:39 +00:00
Mathias Vorreiter Pedersen
671904d58c
C++: Fix QLoc on 'PartialFlowFunction'.
2024-02-22 13:27:10 +00:00
Mathias Vorreiter Pedersen
aca3970c33
C++: Fix QLoc on 'isPartialWrite'.
2024-02-22 13:25:13 +00:00
Robert Marsh
875ab74c28
Merge branch 'main' into rdmarsh2/cpp/ir-synthetic-destructors
...
Fixes conflicts in C++ IR tests and Stmt.qll
2024-02-21 21:34:49 +00:00
Robert Marsh
66743fb0db
C++: refactor TranslatedReturnStmt
2024-02-21 20:50:30 +00:00
Robert Marsh
e0c7849f52
C++: fix incorrect use of getChildInternal
2024-02-21 20:35:58 +00:00
github-actions[bot]
37f8fa3413
Post-release preparation for codeql-cli-2.16.3
2024-02-20 16:50:47 +00:00
github-actions[bot]
6d061fbc35
Release preparation for version 2.16.3
2024-02-20 14:26:23 +00:00
Jeroen Ketema
2becb3043e
Merge pull request #15638 from jketema/destructors5
...
C++: Support C++20 range-based for initializers
2024-02-19 16:22:23 +01:00
Robert Marsh
2494b7d801
C++: fix for IR CFG problem with return in if
2024-02-16 21:08:21 +00:00
Jeroen Ketema
dd39fa0bde
C++: Support C++20 range-based for initializers
2024-02-16 15:20:14 +01:00
Mathias Vorreiter Pedersen
06ff46091d
C++: Fix joins in 'controlsBlock'.
2024-02-16 14:49:20 +01:00
Mathias Vorreiter Pedersen
b407c86d03
C++: Make Code Scanning happy.
2024-02-16 13:51:34 +01:00
Mathias Vorreiter Pedersen
57c1bf5835
C++: Add file-level QLDoc.
2024-02-16 13:47:02 +01:00
Mathias Vorreiter Pedersen
499ab0892f
C++: Currently, to catch flow in an example such as:
...
```cpp
char* source();
void sink(const char*);
int sprintf(char *, const char *, ...);
void call_sprintf(char* path, char* data) {
sprintf(path, "%s", "abc"); // (1)
sprintf(path, "%s", data); // (2)
}
void foo() {
char path[10];
call_sprintf(path, source()); // (3)
sink(path);
}
```
we identify that the `*path [post update]` node at `// (2)` is a
`ReturnNodeExt` and since `*data` flows to that node flow will be carried
out to `*path [post update]` at // (3) and thus reach `sink(path)`.
The reason `*path [post update]` at `// 2` is recognized as a `ReturnNodeExt`
is because it satisfies the following condition (which is identified by the
shared dataflow library):
There is flow from the parameter node `*path` to the pre-update node of the
post-update node `*path [post update]` at `// (2)`.
However, when we start recognizing that the call to `sprintf(path, ...)` at
`// (1)` overrides the value of `*path` and no longer provide use-use flow out
of `*path` the `*path [post update]` node at `// (2)` is no longer recognized
as a `ReturnNodeExt` (because it doesn't satisfy the above criteria).
Thus, we need to identify the flow above without relying on the dataflow
library's summary mechanism. That is, instead of relying on the dataflow
library's mechanism to summarize the `*data -> *path` flow for `call_sprintf`
we need to:
- Ensure that the write to `*path` at `// (2)` is recognized as the "final"
write to the parameter, and
- Ensure that there's flow out of that parameter and back to
`*path [post update]` at `// (3)`.
Luckiky, we do all of this already to support flow out of writes to parameters
that don't have post-update nodes. For example, in something like:
```cpp
void set(int* x, int y) {
*x = y;
}
void test() {
int x;
set(&x, source());
sink(x);
}
```
So in order to make the original example work, all we need to do is to remove
the restrictions on this mechanism so that the same mechanism that makes the
above example work also makes the original example work!
2024-02-16 13:09:45 +01:00
Mathias Vorreiter Pedersen
7e9bf2a880
C++: Add a model for 'partial updating' and extend models appropriately.
2024-02-16 12:56:19 +01:00