Commit Graph

12880 Commits

Author SHA1 Message Date
Jeroen Ketema
7eca4b4d82 C++: Fix join-order problem with isBefore
Reported here: https://github.com/github/codeql/issues/17743

Without this change on the query provided by the user:
```
[2025-02-25 12:42:01] Evaluated non-recursive predicate quickquery::UnrealFunctionAnnotation.annotates/1#dispred#9cd6c269@c668c8tv in 23846ms (size: 20381473).
Evaluated relational algebra for predicate quickquery::UnrealFunctionAnnotation.annotates/1#dispred#9cd6c269@c668c8tv with tuple counts:
                 1   ~0%    {0} r1 = CONSTANT()[]
             27323   ~0%    {2}    | JOIN WITH `Location::Location.getEndLine/0#dispred#83af84ae#bf` CARTESIAN PRODUCT OUTPUT Rhs.0, Rhs.1
        6162566035   ~0%    {4}    | JOIN WITH `Location::Location.getStartLine/0#d54f9e6c` CARTESIAN PRODUCT OUTPUT Lhs.0, Lhs.1, Rhs.0, Rhs.1
                            {4}    | REWRITE WITH TEST InOut.1 < InOut.3
        3894825644   ~5%    {2}    | SCAN OUTPUT In.2, In.0
          73148692   ~0%    {3}    | JOIN WITH fun_decls_40#join_rhs ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Rhs.1
          73148692   ~0%    {4}    | JOIN WITH `Location::Location.getFile/0#dispred#d1f8b5d1` ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.0, Lhs.2
            864579   ~0%    {2}    | JOIN WITH `Location::Location.getFile/0#dispred#d1f8b5d1` ON FIRST 2 OUTPUT Lhs.2, Lhs.3
          13010742   ~1%    {2}    | JOIN WITH macroinvocations_20#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
          20653781   ~0%    {3}    | JOIN WITH `Macro::MacroAccess.getOutermostMacroAccess/0#d58b05db_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, _, Lhs.1
          20653781   ~4%    {3}    | REWRITE WITH Out.1 := 1
          20381473   ~8%    {2}    | JOIN WITH macroinvocations_03#join_rhs ON FIRST 2 OUTPUT Lhs.0, Lhs.2
                            return r1
```

With this change:
```
[2025-02-25 12:43:10] Evaluated non-recursive predicate quickquery::UnrealFunctionAnnotation.annotates/1#dispred#9cd6c269@11bf8956 in 928ms (size: 20381473).
Evaluated relational algebra for predicate quickquery::UnrealFunctionAnnotation.annotates/1#dispred#9cd6c269@11bf8956 with tuple counts:
            6873   ~3%    {2} r1 = SCAN fun_decls OUTPUT In.4, In.0
            6857   ~0%    {3}    | JOIN WITH `Location::Location.getStartLine/0#d54f9e6c` ON FIRST 1 OUTPUT Lhs.0, Lhs.1, Rhs.1
            6857   ~2%    {3}    | JOIN WITH `Location::Location.getFile/0#dispred#d1f8b5d1` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
         6193961   ~0%    {3}    | JOIN WITH `Location::Location.getFile/0#dispred#d1f8b5d1_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
        27389714   ~1%    {4}    | JOIN WITH macroinvocations_20#join_rhs ON FIRST 1 OUTPUT Lhs.0, Lhs.1, Lhs.2, Rhs.1
        27389714   ~1%    {4}    | JOIN WITH locations_default ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.3, Rhs.4
                          {4}    | REWRITE WITH TEST InOut.3 < InOut.1
        13010742   ~1%    {2}    | SCAN OUTPUT In.2, In.0
        20653781   ~0%    {3}    | JOIN WITH `Macro::MacroAccess.getOutermostMacroAccess/0#d58b05db_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, _, Lhs.1
        20653781   ~4%    {3}    | REWRITE WITH Out.1 := 1
        20381473   ~8%    {2}    | JOIN WITH macroinvocations_03#join_rhs ON FIRST 2 OUTPUT Lhs.0, Lhs.2
                          return r1
```
2025-02-25 12:39:11 +01:00
Alexander Eyers-Taylor
ddfb16899a Merge pull request #18828 from alexet/alexet/fix-flakey-join-order
CPP: Prevent forced bad join order which is saved by context.
2025-02-24 17:54:16 +00:00
Geoffrey White
08913c551d Merge pull request #18827 from geoffw0/exectainted
C++: Expand qldoc and tests for cpp/command-line-injection
2025-02-24 08:53:49 +00:00
Alex Eyers-Taylor
57e985cc21 CPP: Simplify getClassAndNameImpl 2025-02-21 16:23:45 +00:00
Alex Eyers-Taylor
53c5b8ff9e CPP: Prevent forced bad join order. 2025-02-20 16:06:42 +00:00
Geoffrey White
b6f9055566 C++: Add and correct some QLDoc. 2025-02-20 15:33:59 +00:00
Geoffrey White
3954f5e45e C++: Add some test cases. 2025-02-20 15:21:25 +00:00
Geoffrey White
c36e91855f C++: Fix a test case. 2025-02-20 15:21:17 +00:00
github-actions[bot]
ad24f94a77 Post-release preparation for codeql-cli-2.20.5 2025-02-17 17:58:24 +00:00
github-actions[bot]
6f4562f3bd Release preparation for version 2.20.5 2025-02-17 16:55:54 +00:00
Mathias Vorreiter Pedersen
9cfd3391d2 C++: Move 'getImpl' to a private non-member predicate. 2025-02-14 13:01:28 +00:00
Mathias Vorreiter Pedersen
be1af88d23 C++: Add more QLDoc. 2025-02-13 14:28:36 +00:00
Mathias Vorreiter Pedersen
aff03bd721 C++: Delete confusing class synonym. 2025-02-13 14:28:14 +00:00
Mathias Vorreiter Pedersen
f9732c746b C++: Patch up various places that depended on the old IPA type. 2025-02-13 14:28:12 +00:00
Mathias Vorreiter Pedersen
75b6855769 C++: Move useful predicates from the old IPA type for the 'DefinitionExt' type. 2025-02-13 14:28:10 +00:00
Mathias Vorreiter Pedersen
f597ea99e1 C++: Delete the unnecessary IPA type of definitions. 2025-02-13 14:01:32 +00:00
Anders Schack-Mulligen
0b5270979d SSA: Remove the need for ExitBasicBlock in SSA. 2025-02-10 14:36:18 +01:00
Remco Vermeulen
9894e9ef9f Add CCR suites 2025-02-05 01:58:34 +00:00
Arthur Baars
2a32e8865d Merge pull request #18668 from github/post-release-prep/codeql-cli-2.20.4
Post-release preparation for codeql-cli-2.20.4
2025-02-04 14:22:53 +01:00
Jeroen Ketema
89bbef935d Merge pull request #18672 from jketema/codeblock-name
C++: Update expected test results after extractor changes
2025-02-04 13:39:54 +01:00
Jeroen Ketema
1591a56aab C++: Update expected test results after extractor changes 2025-02-04 13:19:49 +01:00
github-actions[bot]
f1b05a79a4 Post-release preparation for codeql-cli-2.20.4 2025-02-04 09:25:09 +00:00
Arthur Baars
dd34690c17 Merge branch 'codeql-cli-2.20.4' into release-prep/2.20.4 2025-02-03 18:37:16 +01:00
github-actions[bot]
573e53e454 Release preparation for version 2.20.4 2025-02-03 15:19:35 +00:00
Mathias Vorreiter Pedersen
0e6936d418 C++: Strip the type when computing the base type of a chain of qualifiers. 2025-02-03 12:42:11 +00:00
Jeroen Ketema
25d8f0e161 Merge branch 'main' into calumgrant/bmn/wrong-type-format-arg-linkage 2025-02-03 11:23:27 +01:00
Calum Grant
6e3a169544 C++: Add change note 2025-02-03 09:48:06 +00:00
Mathias Vorreiter Pedersen
f35fea3bee Merge pull request #18629 from MathiasVP/fix-more-fps-in-buffer-overflow
C++: Fix more FPs in `cpp/overflow-buffer`
2025-01-30 18:28:10 +00:00
Mathias Vorreiter Pedersen
02cf458232 C++: Add change note. 2025-01-30 16:50:22 +00:00
Mathias Vorreiter Pedersen
764a84601f Update cpp/ql/lib/semmle/code/cpp/commons/Buffer.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2025-01-30 16:09:44 +00:00
Jeroen Ketema
94608c5996 C++: Update expected test results
This seemed to have slipped through earlier.
2025-01-30 16:53:24 +01:00
Mathias Vorreiter Pedersen
839640a82f Update cpp/ql/lib/semmle/code/cpp/commons/Buffer.qll
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2025-01-30 15:31:36 +00:00
Anders Schack-Mulligen
8edcad0509 Merge pull request #18634 from aschackmull/cpp/unnest-getkind
C++: Un-nest the if-then-else sequence.
2025-01-30 14:07:07 +01:00
Jeroen Ketema
8f25dbf98d Merge pull request #18606 from jketema/typeref
C++: Support mixed `typedef`s and `using`s
2025-01-30 14:04:48 +01:00
Anders Schack-Mulligen
15171eb1a5 C++: Un-nest the if-then-else sequence. 2025-01-30 13:28:44 +01:00
Mathias Vorreiter Pedersen
9fa3ff74cc C++: Accept test changes. 2025-01-29 18:32:35 +00:00
Mathias Vorreiter Pedersen
403a0eb8e6 C++: Fix FPs in 'cpp/overflow-buffer' caused by unions of structs. 2025-01-29 18:30:20 +00:00
Mathias Vorreiter Pedersen
941ad870cb C++: Move 'hasAFieldWithOffset' to 'Field'. 2025-01-29 18:19:17 +00:00
Mathias Vorreiter Pedersen
3591f84a50 C++: Add lots of tests for CWE-119 involving unions and structs. 2025-01-29 18:11:23 +00:00
Calum Grant
a033ba9347 C++: Detect multiple definitions based on the format parameter index 2025-01-29 13:36:10 +00:00
Mathias Vorreiter Pedersen
4b2c7ef03f Merge pull request #18615 from MathiasVP/fix-fp-buffer-overflow
C++: Fix FPs in `cpp/overflow-buffer`
2025-01-29 12:12:47 +00:00
Mathias Vorreiter Pedersen
48cae7e7ed C++: Accept test changes after previous commit. 2025-01-29 11:04:55 +00:00
Mathias Vorreiter Pedersen
373b38e881 Update cpp/ql/test/query-tests/Security/CWE/CWE-119/semmle/tests/tests.cpp
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2025-01-29 11:03:52 +00:00
Mathias Vorreiter Pedersen
be2777bc31 C++: Don't infer lambda calls when there is a static dispatch to a source or summary callable. 2025-01-28 18:51:31 +00:00
Mathias Vorreiter Pedersen
a35ed57848 Revert "C++: Don't generate parameter nodes for bodyless parameters when there is a summary of the enclosing function."
This reverts commit ad80b36074.
2025-01-28 17:09:45 +00:00
Mathias Vorreiter Pedersen
ff9a4d02f0 Merge pull request #18592 from MathiasVP/fix-enclosing-callable-cpp
C++: Don't generate dataflow nodes for functions with summaries
2025-01-28 16:57:44 +00:00
Mathias Vorreiter Pedersen
202a5e86da C++: Add change note. 2025-01-28 16:07:09 +00:00
Mathias Vorreiter Pedersen
c9a3cf4bd0 C++: Accept test changes. 2025-01-28 15:48:11 +00:00
Mathias Vorreiter Pedersen
d6054c9a51 C++: Infer larger buffer sizes for non-static member variables. 2025-01-28 15:48:04 +00:00
Mathias Vorreiter Pedersen
1643a66183 C++: Add 'cpp/overflow-buffer' FP tests. 2025-01-28 15:44:53 +00:00