Commit Graph

717 Commits

Author SHA1 Message Date
Robert Marsh
08e9eea1f2 Add NegateInstruction 2018-11-06 12:02:38 -08:00
Robert Marsh
a3c6b8e575 C++: port sign analysis library from Java 2018-11-06 12:02:38 -08:00
Jonas Jensen
e03b4f0cb6 Merge pull request #293 from geoffw0/zerosizebuffer
CPP: Better handling of zero-sized buffers
2018-11-06 20:08:39 +01:00
Dave Bartolomeo
62a5aef0de Merge pull request #410 from jbj/range-analysis-tests
C++: Tests for two range analysis bugs
2018-11-06 10:51:12 -08:00
Geoffrey White
ee4cfe8eb7 CPP: Update expected output for changes elsewhere. 2018-11-06 17:58:33 +00:00
Geoffrey White
e6e0d69b7d CPP: Re-apply effect of discover_walk. 2018-11-06 17:53:18 +00:00
Geoffrey White
301c133bef CPP: More descriptive. 2018-11-06 17:53:18 +00:00
Geoffrey White
2042c9c863 CPP: Extend the CPP-205 test (results prior to discover_walk). 2018-11-06 17:53:18 +00:00
Geoffrey White
9c97176896 CPP: Tabs/spaces. 2018-11-06 17:01:30 +00:00
Jonas Jensen
9382c9d528 C++: Regression tests for AV Rule 82
Without the last commit, this addition to the test gives the following
results:

```
+| AV Rule 82.cpp:176:14:176:22 | operator= | Assignment operator in class Forgivable does not return a reference to *this. |
+| AV Rule 82.cpp:181:14:181:22 | operator= | Assignment operator in class Forgivable does not return a reference to *this. |
```
2018-11-06 16:13:44 +01:00
Geoffrey White
792369917a CPP: Fix CWE tags. 2018-11-06 14:36:12 +00:00
Geoffrey White
dd8aa5a8d9 CPP: Fix StrncpyFlippedArgs.ql as well. 2018-11-06 14:29:08 +00:00
Geoffrey White
ad44416189 CPP: Move the fix into Buffer.qll so that it applies to other queries. 2018-11-06 14:29:08 +00:00
Sauyon Lee
f99f44a571 If a destination buffer has size 0, there's probably some hackery going on 2018-11-06 14:29:08 +00:00
Jonas Jensen
da73a033e5 C++: Restore exists(getBlock()) in AV Rule 82
I removed this condition in #362, thinking it was covered by the new
conditions on return statements, but it turns out it wasn't in at least
the following cases.

1. Assignment operators that are deleted or marked private in order to
   make them inaccessible.
2. Templates whose body was not extracted.

While some of these results are technically valid, they are not nearly
as interesting as the results that this query was designed to produce.
2018-11-06 13:42:20 +01:00
Aditya Sharad
553c2f5d34 Merge master into next.
As of 2846d80f1c.
2018-11-06 11:52:51 +00:00
Jonas Jensen
4a02b3946d C++: Tests for two range analysis bugs 2018-11-06 11:57:41 +01:00
Dave Bartolomeo
3133bf6675 C++: Fix test expectation 2018-11-05 14:19:59 -08:00
Dave Bartolomeo
0c796de831 C++: Fork AV Rule 78 into NonVirtualDestructorInBaseClass
AV Rule 78 has proved too noisy for use on lgtm.com. However, if we make the rule less noisy by, say, allowing a protected destructor to be non-virtual, we're no longer actually enforcing AV Rule 78. Instead, I've copied AV Rule 78 into NonVirtualDestructorInBaseClass.ql, given the new query the `@id` that AV Rule 78 had, and given AV Rule 78 a new JSF-specific `@id`. The new rule allows non-public non-virtual destructors, which is the problem originally reported by an lgtm.com user.
2018-11-05 14:16:35 -08:00
Jonas Jensen
ba91f3e77c Merge pull request #401 from geoffw0/loopdir
CPP: Speed up inconsistentLoopDirection.ql.
2018-11-05 18:22:19 +01:00
Aditya Sharad
bfa4c30784 C++: Improve performance of ExprEvaluator::getFunctionValue.
Changes the `forex` range to join on both `this` (the current `ExprEvaluator`) and `ret` (the expected function return value),
so that we look at the relevant return values rather than all interesting functions.
2018-11-05 16:51:23 +00:00
Geoffrey White
5cd7103841 Merge pull request #403 from jbj/FlowVar-getAnAccess-perf
C++: Performance fix for FlowVar.getAnAccess
2018-11-05 16:46:49 +00:00
Geoffrey White
a38fefe7ba CPP: Fix trailing space. 2018-11-05 15:21:27 +00:00
Geoffrey White
3cb4211c78 CPP: Exclude code in macro invocations. 2018-11-05 15:07:22 +00:00
Geoffrey White
b4adfec2ef CPP: Add test case. 2018-11-05 14:19:16 +00:00
Jonas Jensen
9a3907c97f C++: Performance fix for FlowVar.getAnAccess
The previous formulation of this predicate caused a CP in snapshots
where a variable had a large number of definitions and also reached a
large number of sub-basic-blocks.

This should fix performance of https://github.com/FrodeSolheim/fs-uae
and https://github.com/libretro/libretro-uae.

The `FlowVar.getAnAccess` predicate is still at risk of CP'ing when a
large group of defs has a large group of uses, but that has not been
observed to happen in practice yet. We would need to make
`localFlowStep` expose phi definitions in order to avoid that risk.
2018-11-05 10:52:17 +01:00
Geoffrey White
1561363582 CPP: Speed up illDefined*ForStmt in inconsistentLoopDirection.ql. 2018-11-02 16:01:23 +00:00
Aditya Sharad
3483245870 Merge rc/1.18 into master.
As of 3291a30bf4.
2018-11-02 09:54:50 +00:00
Arthur Baars
19f238a51a Merge pull request #399 from adityasharad/version/1.18.2-dev
Version: Bump to 1.18.2 dev.
2018-11-02 08:56:33 +01:00
Aditya Sharad
3291a30bf4 Version: Bump to 1.18.2 dev. 2018-11-01 18:46:56 +00:00
Geoffrey White
a3dfa3140c CPP: Make Handlers always begin a BasicBlock. 2018-11-01 15:27:43 +00:00
Pavel Avgustinov
d5c8ea38b1 SuspiciousCallToMemset: Simplify pointer indirection computation 2018-11-01 14:34:04 +00:00
Jonas Jensen
ea601b2dc0 Merge pull request #352 from dave-bartolomeo/dave/Operands
C++: Operands as IPA types
2018-11-01 10:12:38 +01:00
Aditya Sharad
b896899f4c Merge master into next.
master as of dc3c5a684c
Version numbers resolved in favour of `next`.
C++ expected output file updated to accept test output.
2018-10-31 10:47:31 +00:00
Geoffrey White
092db18f96 CPP: Also update reachable for ControlFlowNodes. 2018-10-30 14:28:47 +00:00
Geoffrey White
1092cb97e5 CPP: Have reachability flow to the Handler as well as the CAtchBlock of an exception. 2018-10-30 14:27:22 +00:00
Geoffrey White
6e940d7bf2 CPP: Improve nonReturningFunction. 2018-10-30 14:25:38 +00:00
Geoffrey White
1a6229621c CPP: Tidy up query formatting a little. 2018-10-30 14:25:37 +00:00
Geoffrey White
6427e9658b CPP: Remove successor edges from non-returning functions from the control flow graph. 2018-10-30 14:25:32 +00:00
Geoffrey White
44f5e26fb0 CPP: More test cases. 2018-10-30 14:20:48 +00:00
Geoffrey White
f2ba627291 CPP: Extend the c++_exceptions test. 2018-10-30 14:11:48 +00:00
Geoffrey White
a346f412bc CPP: Add test cases. 2018-10-30 14:11:36 +00:00
Aditya Sharad
256b829201 Merge rc/1.18 into master. 2018-10-30 11:21:50 +00:00
Geoffrey White
bfb5731b19 Merge pull request #377 from ian-semmle/fix_member_function_indices
C++: Accept test changes following fix_member_function_indices
2018-10-30 08:57:04 +00:00
Jonas Jensen
3340e79aad Merge pull request #371 from ian-semmle/av85
C++: Fix AV Rule 85
2018-10-30 08:40:43 +01:00
Robert Marsh
fda75abcd7 Merge pull request #381 from geoffw0/comments
CPP: Fix false positive in EmptyBlock.ql
2018-10-29 15:35:08 -07:00
Aditya Sharad
5e7b7818df Version: Bump to 1.18.1 release. 2018-10-29 18:02:58 +00:00
semmle-qlci
a4371ca824 Merge pull request #338 from geoffw0/hresult
Approved by dave-bartolomeo
2018-10-29 17:04:54 +00:00
Geoffrey White
fc6b791f58 CPP: Speed it up. 2018-10-29 16:52:44 +00:00
Geoffrey White
55465c3eae CPP: Add some comments to the QL. 2018-10-29 16:39:49 +00:00