Jonas Jensen
dcf910f20c
C++: Use EscapesTree to find pointers to stack
...
This simplifies the query and is a strict improvement on the tests. I
also found it to be an overall improvement on real projects.
2019-02-21 11:20:25 +01:00
Jonas Jensen
9f2fdbbc1d
C++: More tests for RedundantNullCheckSimple
2019-02-21 10:13:25 +01:00
Jonas Jensen
9ac8d60636
C++: IR query for redundant null check
...
This new query is not written because it's the most interesting query we
could write but because it's an IR-based query whose results are easy to
verify.
2019-02-21 10:13:25 +01:00
Geoffrey White
d30bcb6fcf
CPP: Widen allocReachedVariable slightly.
2019-02-20 10:19:57 +00:00
Geoffrey White
23ae12a763
CPP: Add test cases.
2019-02-20 10:19:57 +00:00
Geoffrey White
6a17ebbd1b
CPP: Add test cases and renumber.
2019-02-20 10:09:57 +00:00
Geoffrey White
4e77f586da
CPP: Fix file names.
2019-02-20 10:08:27 +00:00
Jonas Jensen
2550788598
C++: Accept test changes to getRelativePath
...
After a `queries.xml` was added to the test directory,
`Container.getRelativePath` now considers source files to be relative to
the `cpp/test` directory rather than the directory of the `*.ql*` file.
This caused some benign test output changes, and it also caused an
unwanted alert for `test3.c:14` to appear in
`cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/IntegerOverflowTainted.expected`.
This alert came about because `inSystemMacroExpansion` holds for files
that don't have a relative path, but the pretend system header in
`../system_header` now does have a relative path because it's below the
`cpp/test` directory. The fix is to add another `queries.xml` just for
the directory with the affected test.
2019-02-18 14:41:28 +01:00
Geoffrey White
2321ae911e
CPP: Fix the test by adding PotentiallyDangerousFunction.
2019-02-05 17:58:30 +00:00
Geoffrey White
429f53ed74
CPP: Move the 'gets' case.
2019-02-05 17:58:30 +00:00
Geoffrey White
a82832e779
CPP: Add a test that uses 'gets'.
2019-02-05 17:58:30 +00:00
Jonas Jensen
45a995ba52
C++: Accept test changes from last commit
2019-02-04 13:00:28 +01:00
Jonas Jensen
be2a480394
Merge pull request #843 from geoffw0/strtoul
...
CPP: Improve ArithmeticTainted.ql
2019-01-31 07:04:17 -08:00
Geoffrey White
07adf6f201
CPP: Handle array accesses.
2019-01-30 18:36:32 +00:00
Geoffrey White
4685f193f5
CPP: Widen varMaybeStackAllocated.
2019-01-30 18:36:32 +00:00
Geoffrey White
25e11512db
CPP: Add a test of ReturnStackAllocatedMemory.
2019-01-30 18:36:31 +00:00
Jonas Jensen
d776d9f903
Merge pull request #821 from geoffw0/query-tags-case
...
CPP: Improve ArrayArgSizeMismatch.ql
2019-01-29 03:52:52 -08:00
semmle-qlci
bf64fee4bd
Merge pull request #790 from rdmarsh2/rdmarsh/cpp/futile-params
...
Approved by semmledocs-ac
2019-01-28 22:11:44 +00:00
Geoffrey White
b0805f8e79
CPP: Adjust ArithmeticTainted.ql so that it can work on non-VariableAccesses.
2019-01-28 17:36:56 +00:00
Geoffrey White
f1dc538796
CPP: Add a test using strtoul in a taint query.
2019-01-28 16:59:02 +00:00
Geoffrey White
1a044a0a22
CPP: Add 'fread' to BufferAccess.qll.
2019-01-25 12:58:25 +00:00
Geoffrey White
fd6365838b
CPP: Add test cases involving fread.
2019-01-25 12:58:25 +00:00
Jonas Jensen
2aca40a021
Merge pull request #736 from geoffw0/macroinv2
...
CPP: Deprecate MacroInvocationExpr and MacroInvocationStmt
2019-01-25 09:02:02 +01:00
Robert Marsh
44d8e6b6e2
C++: respond to PR comments
2019-01-24 10:50:56 -08:00
Geoffrey White
02c69a744f
CPP: Fix false positive.
2019-01-24 15:15:02 +00:00
Geoffrey White
e1d31bf117
CPP: Add a test of ArrayArgSizeMismatch.ql.
2019-01-24 11:20:58 +00:00
Jonas Jensen
61e23bed88
Merge branch 'master' into strcpy-fixups
2019-01-24 10:51:51 +01:00
Robert Marsh
fa02042fda
C++: add more tests and rename test functions
2019-01-23 11:42:44 -08:00
Dave Bartolomeo
bfb8125474
Merge pull request #754 from jbj/copy-assignment-no-effect
...
C++: Exclude assignment operator in ExprHasNoEffect
2019-01-23 00:46:17 -08:00
Jonas Jensen
7bb9deeb34
C++: Recognize more function decls as code
2019-01-21 11:47:35 +01:00
Geoffrey White
821a7bfadd
Merge pull request #779 from jbj/commented-out-code-braces
...
C++: Relax commented-out code heuristic for `}`
2019-01-21 09:37:30 +00:00
Jonas Jensen
9561fdaabf
Merge pull request #672 from geoffw0/lgtm1605
...
CPP: Fix function pointer/lambda related false positives in 'Resource not released in destructor'
2019-01-21 09:35:30 +01:00
Jonas Jensen
169bbcdfa0
Merge pull request #682 from geoffw0/suspiciousaddsizeof
...
CPP: Fix false positive in SuspiciousAddWithSizeof.ql
2019-01-21 09:06:18 +01:00
Geoffrey White
bff23f546d
CPP: Clearer naming.
2019-01-18 16:21:28 +00:00
Jonas Jensen
189d82b79a
C++: Change exclusion to not be only operator=
2019-01-18 11:19:38 +01:00
Robert Marsh
64ed9305d3
C++: new query for futile arguments to C functions
2019-01-17 10:45:10 -08:00
Jonas Jensen
f147b63bb8
Merge pull request #654 from geoffw0/lossyresultcast
...
CPP: Work on Lossy function result cast query
2019-01-17 17:07:29 +01:00
Jonas Jensen
9c42b5fab7
C++: Relax commented-out code heuristic for }
...
I looked through a few hundred results from this query on lgtm.com and
found that most of the FPs had to do with comment lines ending in `}`.
This change should fix most of them, at the cost of very few false
negatives.
On Wireshark, this query goes from 7,425 results to 6,686 results before
filtering for generated code. Almost all the lost results were FP,
except a handful of results involving initializer lists.
2019-01-17 10:20:48 +01:00
Jonas Jensen
92b48bf6af
C++: Add another test for CommentedOutCode.ql
2019-01-17 09:15:25 +01:00
Jonas Jensen
9751a91087
C++: Accept changes to alert message in test
2019-01-14 21:43:57 +01:00
Jonas Jensen
6385dd38cf
C++: Exclude operator= in ExprHasNoEffect
2019-01-11 13:30:08 +01:00
Jonas Jensen
95e457cb49
C++: Add test with FP in ExprHasNoEffect
2019-01-11 13:18:44 +01:00
Jonas Jensen
1cc36dd969
C++: Exclude copy assignment in LargeParameter.ql
...
The purpose of the copy assignment operator is to copy the object, so we
should not complain that a copy happens when passing the parameter. See
https://en.wikibooks.org/wiki/More_C++_Idioms/Copy-and-swap for details.
2019-01-11 12:00:02 +01:00
Jonas Jensen
4ea3849595
C++: Add failing test case for LargeParameter.ql
2019-01-11 11:53:04 +01:00
Geoffrey White
f2e68da322
CPP: Use dataflow to find wrapped rounding functions.
2019-01-10 14:44:11 +00:00
Geoffrey White
207c4d365a
CPP: Test wrapped rounding functions more thoroughly.
2019-01-10 14:39:23 +00:00
Jonas Jensen
aa0f2f2da3
C++: Support ?: in UsingStrcpyAsBoolean.ql
...
I removed some unnecessary parentheses for symmetry, causing whitespace
changes.
2019-01-10 08:35:54 +01:00
Jonas Jensen
0f88a4b312
C++: Test ?: support in UsingStrcpyAsBoolean.ql
...
This test shows that the query only supports the ternary operator in
C++, not C.
2019-01-10 08:35:54 +01:00
Jonas Jensen
4dd36772ef
C++: Remove UsingStrcpyAsBoolean.ql duplicates
2019-01-10 08:35:54 +01:00
Jonas Jensen
3a6a515a1d
C++: Tabs to spaces and // Bug comments in test
...
This changes the column numbers in the expected test output.
2019-01-10 08:35:53 +01:00