Commit Graph

244 Commits

Author SHA1 Message Date
Nora Dimitrijević
a4ac0392a6 C++/OverflowDestination 2025-10-28 09:41:32 +01:00
Mathias Vorreiter Pedersen
72d7223fd0 C++: Small drive by cleanup. Delete unnecessary nested 'exists'. 2025-09-10 12:35:59 +01:00
Mathias Vorreiter Pedersen
d097946e1f C++: No need for this additional case. 2025-09-10 12:35:24 +01:00
Nora Dimitrijević
448a1ea87a [DIFF-INFORMED] C++: OverflowDestination 2025-08-15 12:00:39 +02:00
codeqlhelper
cf21997c0f Reduce false alarms raised by static variables
Static variables are initialized to zero or null by compiler, no need to get an initializer of them.
See https://stackoverflow.com/questions/13251083/the-initialization-of-static-variables-in-c
See 6.7.8/10 in the C99 Standard.

A relevant PR: https://github.com/github/codeql/pull/16527
2025-07-27 23:46:53 +08:00
Mrigank Pawagi
cf60b62981 fix formatting
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
2025-06-30 16:40:03 +00:00
Mrigank Pawagi
809d1d55a8 remove cases involving sizeof 2025-06-28 17:16:04 +00:00
Mrigank Pawagi
93c485fb13 apply proper formatting in comment 2025-06-05 13:26:38 +00:00
Mrigank Pawagi
434973f8e6 Update GlobalUseBeforeInit.ql 2025-06-05 09:48:37 +00:00
Mathias Vorreiter Pedersen
01cbd2f7f1 C++: Ensure that the instruction being compared is the result of the 'CallInstruction'. 2025-01-15 19:27:28 +00:00
Jeroen Ketema
06f6bac169 C++: Silence alerts coming from CMake test compilation files 2025-01-07 14:12:55 +01:00
Nick Rolfe
a2c6278282 C++: fix typo in qhelp 2024-11-19 17:39:05 +00:00
REDMOND\brodes
1005a89007 Updating test cases. 2024-09-05 15:25:23 -04:00
Geoffrey White
20672acb74 Merge pull request #17110 from geoffw0/memfree
C++: Improve cpp/memory-may-not-be-freed
2024-07-31 15:59:42 +01:00
Geoffrey White
4aea4c0323 C++: Simple fix. 2024-07-31 14:46:25 +01:00
Geoffrey White
eaf2949857 Merge pull request #17054 from geoffw0/scanf
C++: Fix false positives in cpp/incorrectly-checked-scanf
2024-07-24 10:51:25 +01:00
Geoffrey White
6026f65f8b C++: Fix FPs in cpp/incorrectly-checked-scanf. 2024-07-23 17:27:37 +01:00
Geoffrey White
437c679266 C++: Switch to using the Buffer.qll implementation directly. 2024-07-22 18:09:08 +01:00
Geoffrey White
7b03f3268f C++: Fix false positives. 2024-07-22 18:00:15 +01:00
Mathias Vorreiter Pedersen
2f7766a557 C++: Autoformat. 2024-05-20 09:04:24 +01:00
codeqlhelper
1d8d45b3aa Static variables are initialized to zero or null by compiler
Static variables are initialized to zero or null by compiler, no need to get an initializer of them
2024-05-19 21:48:43 +08:00
Geoffrey White
53d4a10108 Update cpp/ql/src/Critical/DoubleFree.qhelp
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
2024-05-08 17:15:08 +01:00
Geoffrey White
088f8297b6 C++: Use nullptr. 2024-05-08 14:04:21 +01:00
Geoffrey White
3fd6bc9b5c C++: Fix qhelp format. 2024-05-08 11:46:07 +01:00
Geoffrey White
486226814a C++: Add a second example. 2024-05-08 11:40:29 +01:00
Geoffrey White
575b66a054 C++: Clarify the recommendation and example. 2024-05-07 16:52:50 +01:00
Geoffrey White
dd95a2abab C++: Move qhelp. 2024-05-07 16:35:21 +01:00
Mathias Vorreiter Pedersen
c3cf425079 C++: Use interpolation to avoid a bad join order. 2024-04-16 16:24:08 +01:00
Mathias Vorreiter Pedersen
e1884c193b C++: Add tests (and fix a missing quote in the alert message). 2024-04-16 14:20:19 +01:00
Mathias Vorreiter Pedersen
439afd97ba C++: Small performance optimization. 2024-04-16 13:54:58 +01:00
Mathias Vorreiter Pedersen
132bb9f1d6 C++: Address (my own) review comments. 2024-04-16 13:53:27 +01:00
Mathias Vorreiter Pedersen
8a92a4250f C++: Autoformat. 2024-04-09 17:53:33 +01:00
codeqlhelper
af2a7eadc3 Reduce false alarms of InconsistentNullnessTesting.ql
We should ignore `checked` in a macro to avoid too many false alarms,
2024-04-09 00:07:40 +08:00
codeqlhelper
fb15a4ea11 Reduce the false alarms of GlobalUseBeforeInit.ql 2024-04-09 00:03:05 +08:00
Mathias Vorreiter Pedersen
bd0ddec630 C++: Fix join order in 'cpp/double-free'. 2024-04-02 09:59:53 +01:00
Mathias Vorreiter Pedersen
7fb64268bd Merge pull request #15997 from MathiasVP/simplify-guard-in-missing-check-scanf
C++: Simplify use of guard conditions in `cpp/missing-check-scanf`
2024-03-21 10:16:12 +00:00
Mathias Vorreiter Pedersen
f31bb1391d C++: Simplify 'checkedForEof'. 2024-03-20 16:59:39 +00:00
Mathias Vorreiter Pedersen
5476f42d2c C++: Simplify use of 'GuardCondition's in 'cpp/missing-check-scanf'. 2024-03-20 16:44:43 +00:00
Mathias Vorreiter Pedersen
14aff5c94c C++: Convert 'cpp/missing-check-scanf' to a path-problem query. 2024-03-20 14:54:53 +00:00
Mathias Vorreiter Pedersen
c9dbb7c5a9 C++: Rewrite 'cpp/missing-check-scanf' to use standard dataflow configurations. 2024-03-20 12:01:57 +00:00
Mathias Vorreiter Pedersen
decede51dc C++: Use the new predicate in 'ScanfChecks.qll'. 2024-03-18 16:07:57 +00:00
Mathias Vorreiter Pedersen
ebd1595fbe C++: Fix FP by concluding that a less-than-zero check also implies a not-equal-to-EOF check. 2024-01-29 16:24:36 +00:00
Mathias Vorreiter Pedersen
41f44f598a C++: Explicitly check that a check for EOF isn't present. 2024-01-29 11:33:14 +00:00
Benjamin Rodes
da10e6ca5b Moving FlowAfterFree and UseAfterFree.qll as a general purpose lib. 2024-01-22 11:18:03 -05:00
Benjamin Rodes
833ef9d6d6 Further reorg of libraries and predicates to allow for more reusable and consistent libraries. 2024-01-18 11:17:24 -05:00
Benjamin Rodes
967526b285 Separating out use after free logic into a library and a ql so the query can be expanded easily. 2024-01-18 10:59:17 -05:00
Mathias Vorreiter Pedersen
39dafd6f6a C++: Suggestions to #15343 (#39)
* C++: Change the interface of 'FlowAfterFree' so that the module it takes
a single module as a parameter.

* C++: Add another predicate to the module signature.

* C++: Convert the use-after-free and double-free libraries to use new interface.

* C++: Accept test changes.
2024-01-17 11:02:46 -05:00
Benjamin Rodes
a0ef7955b1 Updating FlowAfterFree to not enforce dominance of source/sink. DoubleFree and UseAfterFree queries now enforce dominance. 2024-01-16 13:15:36 -05:00
Mathias Vorreiter Pedersen
aafde4d18d C++: Fix joins in 'cpp/use-after-free'. 2023-12-18 14:49:09 +01:00
Mathias Vorreiter Pedersen
0543ed115e C++: Add barrier for array lookups in 'cpp/double-free' and 'cpp/use-after-free'. 2023-12-15 14:57:17 +00:00