Commit Graph

1855 Commits

Author SHA1 Message Date
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
Jonas Jensen
9219214d64 Merge pull request #695 from raulgarciamsft/users/raulga/c6324
cpp - Using the return value of a strcpy or related string copy function in an if statement
2019-01-10 08:34:17 +01:00
Geoffrey White
7a877bfe14 CPP: Add exception for wrapped whitelisted functions. 2019-01-09 18:30:19 +00:00
Geoffrey White
f983391cbf CPP: Add exception for pow. 2019-01-09 15:06:23 +00:00
Geoffrey White
11013b0ec6 CPP: Add a few more test cases. 2019-01-09 14:58:25 +00:00
Geoffrey White
cbe69f2daf CPP: Fix false positive. 2019-01-09 13:59:24 +00:00
Geoffrey White
e26c709dbf CPP: Add a test for LossyFunctionResultCast.ql. 2019-01-09 13:59:24 +00:00
Geoffrey White
6088ca5d5b CPP: Update our uses of MacroInvocationExpr. 2019-01-09 12:17:29 +00:00
Geoffrey White
b59c2868cd CPP: Add test cases for the macro logic and other details of ArithmeticUncontrolled.ql. 2019-01-09 12:17:29 +00:00
Raul Garcia
18bb6696e0 Fixing conditional only issue.
I changed  to detect any logical operation usage (i.e. !, ==), but I kept usage in a conditional directly as a separate detection condition. I found no false positives on the projects you shared with me previously.
2019-01-07 10:44:11 -08:00
Raul Garcia
880306c621 Removing duplicated results 2019-01-04 10:45:43 -08:00
Raul Garcia
28932e85d9 Fixing the code based on PR feedback. 2019-01-02 16:23:19 -08:00
Raul Garcia
f8ab945b91 Merge branch 'master' into users/raulga/c6324 2018-12-14 15:46:38 -08:00
Raul Garcia
16f2bacf4d cpp - Using the return value of a strcpy or related string copy function in an if statement 2018-12-14 15:42:49 -08:00
Geoffrey White
e443eb8889 CPP: Fix type logic. 2018-12-13 09:49:32 +00:00
Geoffrey White
c904a338f7 CPP: Add test cases. 2018-12-12 23:47:48 +00:00
Aditya Sharad
f92456fcad Merge master into next.
Conflict in `cpp/ql/test/library-tests/sideEffects/functions/sideEffects.expected`,
resolved by accepting test output (combining changes).
2018-12-12 17:26:18 +00:00
Geoffrey White
2f3a874c7d CPP: Fix false positives when a member variable is released via the target of a function pointer. 2018-12-12 11:38:44 +00:00
Geoffrey White
370387a9ca CPP: Fix false positives when member variable is released via an ExprCall. 2018-12-12 11:38:44 +00:00
Geoffrey White
e408f18766 CPP: Fix false positives when member variable is released via capture inside lambda expression. 2018-12-12 11:38:44 +00:00
Geoffrey White
8e2459a6b7 CPP: Add similar test cases with function pointers. 2018-12-12 11:38:44 +00:00
Geoffrey White
77c1ad47f9 CPP: Add test cases with lambdas. 2018-12-12 11:38:44 +00:00
Robert Marsh
98005edd9d Merge pull request #641 from geoffw0/exprnoeffect2
CPP: More tests of isSideEffectFree() / ExprHasNoEffect.ql
2018-12-11 12:17:30 -08:00
Geoffrey White
0f268cac40 CPP: Fix the issue. 2018-12-07 18:43:27 +00:00
Geoffrey White
02a060fbfa CPP: Add a test. 2018-12-07 18:21:48 +00:00
Geoffrey White
e7390f3ea5 CPP: Add simple tests of CommaExpr. 2018-12-07 14:29:09 +00:00
Aditya Sharad
fcfab26267 Merge rc/1.19 into next. 2018-12-07 12:31:51 +00:00
Geoffrey White
d85f4b540c CPP: Fix false positive. 2018-12-05 10:01:54 +00:00
Geoffrey White
e7f19e97cb CPP: Add a test of UnusedStaticVariable.ql. 2018-12-05 10:01:54 +00:00
Jonas Jensen
6239455a91 C++: Remove extra type check in AV Rule 82
These type checks were overlapping with `assignOperatorWithWrongType` is
are no longer needed now that `assignOperatorWithWrongType` is improved.
They were causing FPs and misleading error messages on uninstantiated
templates.
2018-12-04 12:59:21 +01:00
Jonas Jensen
8ac427c387 C++: Add missing getUnspecifiedType in AV Rule 82
Adding this call to `getUnspecifiedType` makes the error message better
in the presence of typedefs and qualifiers on an assignment operator
return type. It's also needed to avoid losing valid results in the
commit that comes after this.
2018-12-04 11:13:11 +01:00
Jonas Jensen
a78ded7551 C++: Demonstrate FP in AV Rule 82
The added test is a reduced version of a FP observed in the wild.
2018-12-04 11:09:35 +01:00
Jonas Jensen
b80cf30cee Merge pull request #562 from geoffw0/cpp-308
CPP: Fix FPs for 'Resource not released in destructor' involving virtual method calls
2018-12-03 15:57:11 +01:00
Geoffrey White
dfbccc4bcf CPP: Additional test cases. 2018-12-03 13:11:52 +00:00
Jonas Jensen
60076cb734 Merge pull request #532 from geoffw0/query-tags-3
CPP: Query Tags 3 (JPL_C queries)
2018-11-30 15:45:01 +01:00
Jonas Jensen
9babb4366b Merge remote-tracking branch 'upstream/master' into mergeback-20181130 2018-11-30 10:13:33 +01:00
Geoffrey White
0eb0bf988e CPP: Fix for virtual method calls. 2018-11-28 14:19:24 +00:00
Geoffrey White
7107cec503 CPP: Add test cases. 2018-11-27 17:20:14 +00:00