Commit Graph

7071 Commits

Author SHA1 Message Date
Jonas Jensen
92fbea4e41 C++: UsingStrcpyAsBoolean.ql: use getName
We agreed in the review of the original PR that `getName` is more
appropriate here than `getQualifiedName`. Using `getName` ensures that
we also match the `std::`-prefixed versions of these functions as well
as user-defined versions.
2019-01-10 08:35:54 +01: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
4dd36772ef C++: Remove UsingStrcpyAsBoolean.ql duplicates 2019-01-10 08:35:54 +01:00
Jonas Jensen
aafb4abc3d C++: Use more specific predicates than getChild
This commit doesn't change any behavior but just uses the preferred
high-level predicates. The `getChild` predicate inspects the raw
database more or less directly, and the database layout could change in
the future.
2019-01-10 08:35:53 +01:00
Jonas Jensen
657fe0eda3 C++: Tweak docs of UsingStrcpyAsBoolean.ql
This should make the documentation more in line with the documentation
for our other queries. The @name of the query is changed to "Use of
string copy function in a condition".
2019-01-10 08:35:53 +01:00
Jonas Jensen
563f8158d7 C++: Autoformat UsingStrcpyAsBoolean.ql 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
Ian Lynagh
7a0ed57916 C++: Add namespace_inline 2019-01-09 14:47:27 +00:00
Geoffrey White
82e54568a5 CPP: Add qhelp. 2019-01-09 14:03:28 +00:00
Jonas Jensen
8ac826a62a C++: Factor out base case of normalGroupMember
This recursive predicate is made faster by working around a known
optimizer problem (QL-796) that causes the optimizer to insert extra
type checks in recursive case even when they are only needed in the
base case.
2019-01-09 15:02:25 +01:00
Geoffrey White
cbe69f2daf CPP: Fix false positive. 2019-01-09 13:59:24 +00:00
Geoffrey White
0e092ae88d CPP: Tag LossyFunctionResultCast.ql. Will be run on LGTM. 2019-01-09 13:59:24 +00:00
Jonas Jensen
c74b89119e C++: Reorder parameters to subEdge relations
This improves performance slightly by putting the parameters in the
order in which they'll be needed in `qlCFGSuccessor`.
2019-01-09 14:58:43 +01:00
ian-semmle
b3bcabf7c6 Merge pull request #724 from jbj/cfg-pr
C++: Construct a CFG with QL
2019-01-09 13:12:39 +00:00
Geoffrey White
6088ca5d5b CPP: Update our uses of MacroInvocationExpr. 2019-01-09 12:17:29 +00:00
Geoffrey White
a1caa85172 CPP: Deprecate MacroInvocationExpr. 2019-01-09 11:45:08 +00:00
Geoffrey White
75b1fb36ec CPP: Deprecate MacroInvocationStmt. 2019-01-09 11:45:08 +00:00
Robert Marsh
c39de75d3d C++: change in-predicate comment formatting 2019-01-08 09:34:29 -08:00
Robert Marsh
af8a3f2522 C++: expand a comment 2019-01-08 09:34:28 -08:00
Robert Marsh
0040a2d123 C++: respond to further PR comments 2019-01-08 09:34:28 -08:00
Robert Marsh
8c9c316e1b C++: performance and termination fixes 2019-01-08 09:34:27 -08:00
Robert Marsh
567eee1114 C++: allow phi nodes to self-bound 2019-01-08 09:34:27 -08:00
Robert Marsh
2f8ca8802b C++: switch to using ValueNumbers as bounds
This reduces the number of bounds computed, and will simplify use of the
library. The resulting locations in the tests may be slightly strange,
because the example `Instruction` for a `ValueNumber` is the first
appearing in the IR, regardless of source order, and may not be the most
closely related `Instruction` to the bounded value. I think that's worth
doing for the performance and usability benefits.
2019-01-08 09:34:26 -08:00
Robert Marsh
89148a9ec7 C++: respond to further PR comments 2019-01-08 09:34:26 -08:00
Robert Marsh
ae4ffd9166 C++: respond to PR comments, add some TODOs 2019-01-08 09:34:25 -08:00
Robert Marsh
fe32aea31f C++: fix/add comments 2019-01-08 09:34:25 -08:00
Robert Marsh
ed68f9150a C++: Initial implementation of new range analysis 2019-01-08 09:34:23 -08:00
Jonas Jensen
1be91b5df5 C++: Use IPA for Pos and Spec
This is cleaner than extending `int` and working with magic numbers.
Performance appears to be unaffected.
2019-01-08 16:23:11 +01:00
Jonas Jensen
dba3351d2c C++: Update comments based on PR feedback 2019-01-08 13:29:03 +01: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
Jonas Jensen
26f32f0d6d C++: Initial version of CFG.qll
This implements calculation of the control-flow graph in QL. The new
code is not enabled yet as we'll need more extractor changes first.

The `SyntheticDestructorCalls.qll` file is a temporary solution that can
be removed when the extractor produces this information directly.
2019-01-04 13:34:36 +01:00
Max Schaefer
b4f400fb23 Merge remote-tracking branch 'upstream/next' into qlucie/master 2019-01-04 10:35:57 +00:00
Jonas Jensen
a47faa2272 C++: Add ConditionDeclExpr convenience predicates
Also expand the QLDoc.
2019-01-04 10:24:08 +01:00
Jonas Jensen
ca0517b3d6 C++: LocalVariable docs 2019-01-04 10:24:08 +01:00
Jonas Jensen
8f9849b30b C++: Add BuiltInIntAddr class for __INTADDR__ 2019-01-04 10:24:08 +01:00
Jonas Jensen
79e246f961 Merge pull request #722 from geoffw0/doc-macroinv
CPP: Improve qldoc for MacroAccess and MacroInvocation.
2019-01-04 08:40:37 +01:00
Ian Lynagh
187fdf67b0 C++: Rename twoOperand to isTwoOperand 2019-01-03 21:09:49 +00:00
Ian Lynagh
283eb51db8 C++: Update stats after adding expr_cond* tables 2019-01-03 21:09:49 +00:00
Ian Lynagh
dc3d87f2fc C++: Add tables for ConditionalExprs 2019-01-03 21:09:49 +00:00
Raul Garcia
89c045b550 Merge branch 'users/raulga/c6324' of https://github.com/raulgarciamsft/ql into users/raulga/c6324 2019-01-03 10:06:59 -08:00
Raul Garcia
2c1d7bbc41 Switched to DataFlow::localFlow to avoid false positives. 2019-01-03 10:06:49 -08:00
Geoffrey White
787febae6e CPP: Improve qldoc for MacroAccess and MacroInvocation. 2019-01-03 15:16:47 +00:00
Jonas Jensen
b17fb86961 C++: Factor out reachable base case 2019-01-03 11:20:18 +01:00
Raul Garcia
e7bc3e6c0d Update UsingStrcpyAsBoolean.cpp 2019-01-02 17:33:28 -08:00
Raul Garcia
28932e85d9 Fixing the code based on PR feedback. 2019-01-02 16:23:19 -08:00
Jonas Jensen
d566141273 Merge pull request #694 from dave-bartolomeo/dave/BetterUnreached
C++: Remove infeasible edges to reachable blocks
2018-12-21 07:36:51 +00:00
Dave Bartolomeo
a7cb2d6d7c C++: Ignore Unreached blocks in IR Guards 2018-12-20 11:57:25 -08:00