Commit Graph

13876 Commits

Author SHA1 Message Date
Geoffrey White
ab89f1307d CPP: Tag defect filter queries. 2019-01-24 11:15:21 +00:00
Geoffrey White
b791ff8c28 CPP: Tag metric filter queries. 2019-01-24 11:15:21 +00:00
Geoffrey White
132b29fa22 CPP: Tag the Architecture queries. 2019-01-24 11:15:21 +00:00
Geoffrey White
9a9b01bbb0 CPP: Add external/powerof10 tags. 2019-01-24 11:15:21 +00:00
Geoffrey White
30c6637415 CPP: Tag the Power of 10 queries. 2019-01-24 11:15:20 +00:00
Jonas Jensen
ea018a2abc Merge pull request #816 from geoffw0/code-tidy-27
CPP: Code tidy / qldoc
2019-01-24 11:35:00 +01:00
Jonas Jensen
61e23bed88 Merge branch 'master' into strcpy-fixups 2019-01-24 10:51:51 +01:00
Dave Bartolomeo
63ed0c5f21 Merge pull request #811 from jbj/ir-successor-sanity
C++: IR sanity queries for outgoing edges
2019-01-23 23:11:57 -08:00
Robert Marsh
fa02042fda C++: add more tests and rename test functions 2019-01-23 11:42:44 -08:00
Geoffrey White
fc142c71be CPP: QLDoc cleanup. 2019-01-23 17:58:52 +00:00
Geoffrey White
7c6dfc90de CPP: Make some implementation predicates private. 2019-01-23 17:48:32 +00:00
Geoffrey White
64141b2817 CPP: QLDoc cleanup. 2019-01-23 17:48:32 +00:00
Jonas Jensen
bb7369e844 C++: Use new back-edge def. in range analysis
By using this new definition of back edges, the range analysis should
work on code that uses unstructured `goto`s.
2019-01-23 11:40:13 +01:00
Jonas Jensen
b40accee6f C++: sanity checks for back edges 2019-01-23 11:40:12 +01:00
Jonas Jensen
38f7ec7d18 C++: Initial implementation of back-edge detection 2019-01-23 11:40:12 +01:00
Jonas Jensen
b2e5d235de C++: IR sanity queries for outgoing edges
These queries have no results on our test cases in the repo, but
`ambiguousSuccessors` has results on any large C++ code base, and
`unexplainedLoop` has results on Windows builds of ChakraCore.
2019-01-23 11:07:49 +01:00
Jonas Jensen
eaa5a5fab7 Merge pull request #809 from geoffw0/enclosing
CPP: Small change to 'Resource not released in destructor'
2019-01-23 11:07:21 +01: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
Geoffrey White
175ff9644a CPP: Change * to +. 2019-01-22 16:41:57 +00:00
Geoffrey White
fccf30eff5 Merge pull request #803 from jbj/commented-out-code-const
C++: Recognize more function decls as code
2019-01-22 16:40:08 +00:00
Geoffrey White
feeb391737 Merge pull request #769 from jbj/fully-converted-perf
C++: Speed up Expr.getFullyConverted slightly
2019-01-22 14:02:22 +00:00
Geoffrey White
aba73f4aac Merge pull request #801 from jbj/mergeback-20190121
C++: Merge rc/1.19 and #777
2019-01-22 08:54:26 +00:00
Geoffrey White
fab8e526f3 CPP: Replace call to getEnclosingAccessHolder() with getEnclosingElement(). 2019-01-21 18:30:20 +00: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
b30c9bc571 Merge remote-tracking branch 'upstream/source/pr/777/head' into mergeback-20190121 2019-01-21 09:59:04 +01:00
Jonas Jensen
7912c8106b Merge remote-tracking branch 'upstream/rc/1.19' into mergeback-20190121 2019-01-21 09:58:37 +01: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
Geoffrey White
458fddd28e CPP: Use strictconcat. 2019-01-18 15:01:47 +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
Dave Bartolomeo
6af8948a3f Merge pull request #783 from jbj/ir-reachable-perf
C++: Speed up getAFeasiblePredecessorBlock
2019-01-17 10:19:07 -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
6b9aaf63d7 C++: Speed up getAFeasiblePredecessorBlock
This predicate was unbearably slow on a ChakraCore snapshot (and
probably everywhere else):

    ReachableBlock::getAFeasiblePredecessorBlock#2#ff#antijoin_rhs .. 1m6s
    ReachableBlock::getAFeasiblePredecessorBlock#ff#antijoin_rhs .... 31.8s

With this change, the predicate is so fast that it doesn't even show up
in the clause timing report.

It's possible that we only tested this for performance in 1.18, and then
it has regressed in 1.19. Otherwise I can't explain how we've missed
this. I'm using QL for Eclipse 1.20.0.201901070127.
2019-01-17 13:36:20 +01:00
Jonas Jensen
2478d440c2 C++: Address doc review comments 2019-01-17 12:01:49 +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
Geoffrey White
c62cfb338a CPP: Clean up comment. 2019-01-16 19:10:35 +00:00
Geoffrey White
49cfa43fd8 CPP: Improve accuracy further. 2019-01-16 19:05:51 +00:00
Geoffrey White
105f8dddd0 CPP: Better fileHeaderLimit. 2019-01-16 19:05:50 +00:00
Geoffrey White
91c736229c CPP: Performance is better as a single regexp. 2019-01-16 19:05:50 +00:00
Geoffrey White
e3056ca96c CPP: Improve accuracy of AutogeneratedFile.qll. 2019-01-16 19:05:50 +00:00
Jonas Jensen
22b15037fc C++: Split DataFlow::Node.asExpr into two
The existing `Node.asExpr` predicate changes semantics so it becomes the
one that most users should use when they don't want to think about
`Conversion`s. A new `Node.asConvertedExpr` predicate is added and has
the same semantics as the old `Node.asExpr` predicate. It's for advanced
users that know about `Conversion`s and want to account for them.
2019-01-16 14:17:57 +01:00
Jonas Jensen
dcb24e07c3 C++: Remove getFullyConverted call in sink def
With this change, the `IRDataflowTestCommon.qll` and
`DataflowTestCommon.qll` files use the same definitions of sources and
sinks. Since the IR data flow library is meant to be compatible with the
AST data flow library, this is what we ought to be testing.

Two alerts change but not necessarily for the right reasons.
2019-01-16 13:56:52 +01:00
Jonas Jensen
502b7cfe33 C++: Don't use C-style varargs in test.cpp sink
As we prepare to clarify how conversions are treated, we don't want a
`sink(...)` declaration where it's non-obvious which conversions are
applied to arguments.
2019-01-16 09:47:58 +01:00
Jonas Jensen
b3f46d757a C++: isConstant() -> exists(getValue())
This code was clearly using `isConstant` as an indirect way of checking
whether `getValue` would have a result. That's no longer valid, so I
changed it to check `getValue` directly.
2019-01-15 19:03:49 +01:00
Jonas Jensen
d81e6e9bb8 C++: Add TranslatedElement::isIRConstant
Now that there exist constants with no QL-representable value, we need
to make sure they're not treated as constants in the IR.
2019-01-15 17:35:14 +01:00
Jonas Jensen
0f2c7005fc C++: Sync files that should be identical
These files had come out of sync due to 89148a9ec7 and 8c9c316e1b. I
synced the files by replaying the changes that those commits made in
`aliased_ssa/` to the two other copies.
2019-01-15 16:01:54 +01:00