Commit Graph

1899 Commits

Author SHA1 Message Date
Geoffrey White
01ba635e1d CPP: Add some test cases involving dataflow. 2018-11-22 15:49:13 +00:00
Jonas Jensen
75873bb4a6 C++: Detect non-allocating placement new
This adds a `NewOrNewArrayExpr.getPlacementPointer` predicate and uses
it in `Alloc.qll` to detect when a `new`-expression is not an
allocation.

User-defined replacements for `operator new` may not be allocations
either, but the code continues to assume that they are. It's possible
that we want to change this assumption in the future or leave it up to
individual queries to decide on which side to err. It's hard to
statically tell whether `operator new` has been overloaded in a
particular file because it can be overloaded by a definition that is not
in scope but is only linked together with that file.
2018-11-22 11:31:19 +01:00
Jonas Jensen
a17debac3e C++: Placement-new tests for MemoryNeverFreed.ql 2018-11-22 10:48:18 +01:00
semmle-qlci
62db19bee7 Merge pull request #492 from geoffw0/offsetuse
Approved by dave-bartolomeo
2018-11-21 17:26:48 +00:00
Jonas Jensen
4e2d40aad8 Merge pull request #484 from geoffw0/limitedscopefile
CPP: Fix Limitedscopefile.ql
2018-11-21 14:30:48 +01:00
Geoffrey White
9922e36590 CPP: Add missing file. 2018-11-20 16:55:10 +00:00
Jonas Jensen
33111b6b27 Merge pull request #498 from geoffw0/test-cleanup
CPP: Clean up some test code.
2018-11-20 14:44:52 +01:00
Geoffrey White
342164ff71 CPP: Clean up / normalize some test code. 2018-11-20 09:50:59 +00:00
Jonas Jensen
6c0305cb80 Merge pull request #495 from geoffw0/returnvalue
CPP: Fix 'Missing return statement'
2018-11-20 10:16:30 +01:00
Jonas Jensen
cc28d04ba7 Merge pull request #405 from geoffw0/selfcompare
CPP: Fix false positives in PointlessSelfComparison.ql
2018-11-20 09:25:10 +01:00
Geoffrey White
5cae65295d CPP: Fix FPs from AV Rule 114.ql. 2018-11-19 16:09:40 +00:00
Geoffrey White
d18a7012f5 CPP: Add a test case. 2018-11-19 16:08:32 +00:00
Geoffrey White
33130b9800 CPP: Apply recommended fix. 2018-11-19 14:39:28 +00:00
Geoffrey White
6a14748af8 CPP: Add recommended test. 2018-11-19 14:25:11 +00:00
Jonas Jensen
111df470c3 Merge pull request #485 from geoffw0/limitedscopefunction
CPP: Fix Limitedscopefunction.ql
2018-11-19 14:51:20 +01:00
Jonas Jensen
6d17642240 Merge pull request #476 from geoffw0/av_165
CPP: Fix AV Rule 165
2018-11-19 14:32:02 +01:00
Geoffrey White
e72505707b CPP: Check for a range check before the use. 2018-11-19 11:49:22 +00:00
Geoffrey White
6cdfaeea3c CPP: getAChild() -> getAChild*(). 2018-11-19 11:47:14 +00:00
Geoffrey White
01611d4d96 CPP: Add a test for OffsetUseBeforeRangeCheck.ql. 2018-11-19 11:47:14 +00:00
Geoffrey White
9f688eb7e2 CPP: Exclude variables that have non-function accesses. 2018-11-16 22:48:30 +00:00
Geoffrey White
2d07410f97 CPP: Exclude variables that are part of an interface. 2018-11-16 22:46:11 +00:00
Geoffrey White
b70c572e34 CPP: Add a test for LimitedScopeFunction. 2018-11-16 22:44:41 +00:00
Geoffrey White
e253ab54d7 CPP: Exclude variables that are part of an interface. 2018-11-16 22:38:16 +00:00
Geoffrey White
0e5d23e78b CPP: Add a test of LimitedScopeFile. 2018-11-16 22:37:30 +00:00
Geoffrey White
d1adc0e3ec CPP: Fix for explicitly cast expressions. 2018-11-14 19:43:24 +00:00
Geoffrey White
3028e85457 CPP: Add a test of AV Rule 164. 2018-11-14 19:40:29 +00:00
Geoffrey White
3f428a8876 CPP: Fix for explicitly cast expressions. 2018-11-14 19:11:56 +00:00
Geoffrey White
5cddabb1fd CPP: Add a test of AV Rule 165. 2018-11-14 19:05:35 +00:00
Aditya Sharad
f0715b09e1 Merge master into next. 2018-11-14 10:06:27 +00:00
Geoffrey White
1d464ae35d CPP: Merge the ExprHasNoEffect tests. 2018-11-12 16:26:50 +00:00
Geoffrey White
1417929cdf CPP: Merge the Todo/FixmeComments tests. 2018-11-12 16:26:50 +00:00
Geoffrey White
03cad6c084 CPP: Move the AV Rule 97 test. 2018-11-12 16:07:03 +00:00
Geoffrey White
2d665e51d0 CPP: Move the BitwiseSignCheck.ql test. 2018-11-12 16:07:03 +00:00
Jonas Jensen
1500237009 Merge remote-tracking branch 'upstream/master' into mergeback-20181112 2018-11-12 13:24:27 +01:00
Jonas Jensen
0caf0f1f15 Merge pull request #430 from geoffw0/exprtemplate
CPP: Exclude template code from ExprHasNoEffect.ql
2018-11-12 09:27:36 +01:00
Aditya Sharad
761e5efd60 Merge master into next.
JavaScript semantic conflicts fixed by referring to the `LegacyLanguage` enum.
C++ conflicts fixed by accepting Qltest output.
2018-11-09 18:49:35 +00:00
Geoffrey White
0e9c7fc085 Merge pull request #416 from raulgarciamsft/users/raulga/c6317
cpp: Incorrect not operator usage
2018-11-09 15:59:57 +00:00
Geoffrey White
5b09e11a52 CPP: Repair macro case. 2018-11-08 10:01:07 +00:00
Geoffrey White
d6f27f0b2d CPP: Add a test of macros. 2018-11-08 09:58:59 +00:00
Raul Garcia
f9edaba5aa Fixing typo.
Restricting to analyze only logical & and | operations
2018-11-07 13:26:09 -08:00
Geoffrey White
7bf9200a18 CPP: Fix (it looks like we already had a similar test, both are fixed. 2018-11-07 14:12:52 +00:00
Geoffrey White
73b186a695 CPP: Add test case. 2018-11-07 13:34:42 +00:00
Jonas Jensen
6f2fd05480 Merge pull request #354 from geoffw0/return-exception
CPP: Remove successor edges after calls to non-returning functions
2018-11-07 09:24:41 +01:00
Raul Garcia
5a35edfbe2 cpp: Incorrect not opeartor usage
Marked as Low precision as Linux kernel code mix the usage of logical operators and bit-wise opeartors.
warning C6317: incorrect operator: logical-not (!) is not interchangeable with ones-complement (~)
2018-11-06 12:49:33 -08: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
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
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