Commit Graph

499 Commits

Author SHA1 Message Date
Max Schaefer
374fd597d7 JavaScript: Reinstate override.
(cherry picked from commit df5a8651c3)
2018-10-19 08:30:03 +01:00
Max Schaefer
b0425a298c JavaScript: Eliminate slow antijoin predicate.
(cherry picked from commit 0cfd04dfa2)
2018-10-19 08:30:03 +01:00
Max Schaefer
5167d43fbc JavaScript: Refactor AnalyzedPropertyWrite::writes to enable correct modelling of variable exports.
(cherry picked from commit 080f974663)
2018-10-19 08:30:03 +01:00
Max Schaefer
898ba94837 JavaScript: Address review comments.
(cherry picked from commit 6835815673)
2018-10-19 08:30:03 +01:00
Max Schaefer
2b7d69aaf4 JavaScript: Add support for Google Cloud Spanner.
(cherry picked from commit cd284b2f97)
2018-10-19 08:30:03 +01:00
Tom Hvitved
b282444740 Revert "JavaScript: Patch CFG to improve support for non-top level import declarations."
This reverts commit f05e777e64.
2018-10-19 08:30:03 +01:00
Max Schaefer
5e75a62f5c JavaScript: Add test case for type inference in the presence of non-toplevel imports.
(cherry picked from commit 8b7bb8cecc)
2018-10-19 08:30:03 +01:00
Max Schaefer
e683b51611 JavaScript: Generalise code that assumes imports only appear at the toplevel.
(cherry picked from commit db32dc2bdf)
2018-10-19 08:30:03 +01:00
Max Schaefer
de108a843d JavaScript: Patch CFG to improve support for non-top level import declarations. 2018-10-19 08:30:03 +01:00
Max Schaefer
6a75ebbae2 JavaScript: Update model of DOMException.
cf. https://developer.mozilla.org/en-US/docs/Web/API/DOMException/DOMException

(cherry picked from commit 8cc7f5c242)
2018-10-17 11:38:29 +01:00
Max Schaefer
d57e93d5c6 JavaScript: Fix typo in query help.
(cherry picked from commit 1ab943c16b)
2018-10-17 11:38:29 +01:00
Geoffrey White
e2a001f925 Merge pull request #285 from jbj/primitive-bb-joinorder
C++: Speed up primitive basic block calculation
2018-10-06 19:47:49 +01:00
Jonas Jensen
11e03b3161 C++: Fix primitive_basic_block_member join order
This predicate looked like a join of two already-computed predicates,
but it was a bit more complicated because the `*` operator expands into
two cases: the reflexive case and the transitive case. The join order
for the transitive case placed the `PrimitiveBasicBlock` charpred call
_after_ the `member_step+` call, which means that all the tuples of
`member_step+` passed through the pipeline.

This commit changes the implementation by fully writing out the
expansion of `*` into two cases, where the base case is manually
specialised to make sure the join orderer doesn't get tempted into
reusing the same strategy for both cases. This speeds up the predicate
from 2m38s to 1s on a snapshot of our own C/C++ code.
2018-10-05 14:26:04 +02:00
Jonas Jensen
265852058d C++: Faster implementation of BB entry node
The existing implementation of `primitive_basic_block_entry_node` was
"cleverly" computing two properties about `node` with a single
`strictcount`: whether `node` had multiple predecessors and whether any
of those predecessors had more than once successor. This was fast enough
on most snapshots, but on the snapshot of our own code it took 37
seconds to compute `primitive_basic_block_entry_node` and its auxiliary
predicates. This is likely to have affected other large snapshots too.

With this change, the property is computed like in our other languages,
and it brings the run time down to 4 seconds.
2018-10-05 14:20:03 +02:00
Jonas Jensen
7691c0a345 Merge pull request #280 from pavgust/imp/use-in-own-init
UseInOwnInitialiser: Refactor logic slightly.
2018-10-04 20:25:36 +02:00
Pavel Avgustinov
6d77a791ac UseInOwnInitialiser: Refactor logic slightly.
By pulling out the class `VariableAccessInInitialiser`, we can
avoid some redundant work on pathological databases, improving
performance.
2018-10-04 14:25:59 +01:00
Nick Rolfe
828d3cb138 Merge pull request #250 from adityasharad/version/1.18.1-dev
Version: Bump to 1.18.1 dev.
2018-10-01 10:59:52 +01:00
Aditya Sharad
1c71a856e1 Version: Bump to 1.18.1 dev. 2018-09-28 16:39:44 +01:00
Max Schaefer
b8b41a42fa Merge pull request #248 from adityasharad/fix/eclipse-versions-1.18
Version: Fix C# and JavaScript Eclipse plugins for 1.18.
v1.18.0
2018-09-28 14:17:40 +01:00
Aditya Sharad
f5bd737ada Version: Fix C# and JavaScript Eclipse plugins for 1.18. 2018-09-28 14:10:06 +01:00
ian-semmle
077ce6a4be Merge pull request #242 from jbj/unresolveCheckResult
C++: Make unresolve dispatch on `result`
2018-09-27 14:59:34 +01:00
Aditya Sharad
1f9da28647 Merge pull request #243 from jbj/CommentedOutCode-join-fix
C++: Fix join order in CommentedOutCode
2018-09-27 14:59:13 +01:00
Jonas Jensen
19435e07a1 C++: Fix join order in CommentedOutCode
After the recent inlining of `unresolveElement`, the join order in
`CommentedOutCode` became a problem. The join orderer was tempted to
join the two `hasLocationInfo` calls first because they had one column
in common. With this commit, they have no columns in common. It follows
from the other predicates in the same file that this column would be the
same, so there is no need to assert it in this predicate and risk that
the join orderer uses that information.

On Wireshark, the `CommentBlock::hasLocationInfo` predicate goes from
taking 2m2s to taking 180ms. The query produces the same 7,448 alerts.
2018-09-27 14:07:13 +02:00
Jonas Jensen
0da452d59a C++: Revert object-orientation of unresolveElement
The change to make `unresolveElement` a member predicate was helpful for
the optimiser when it dispatched on `this`, but now that it "dispatches"
on `result` it's just an unnecessary pollution of the `ElementBase`
namespace.
2018-09-27 13:25:30 +02:00
Jonas Jensen
c61b311682 C++: Make unresolve dispatch on result, not this
This change means that there are no results for `unresolveElement(t)`
where `t` is a "junk type" -- a class definition that is not in the
image of `resolveClass`. These "junk types" still exist as `Element`s,
but they will never be returned by any predicate that goes through
`unresolveElement` to query the db.

We get a small reduction in DIL size and a significant speed
improvement. The DIL for `NewArrayDeleteMismatch.ql` is reduced from
27,630 lines to 27,507 lines, and the total analysis time for the LGTM
suite on jdk8u is reduced from 1158s to 984s.
2018-09-27 13:23:11 +02:00
Aditya Sharad
4767d85a96 Merge pull request #239 from ian-semmle/type_mention
C++: Update test output
2018-09-27 11:02:46 +01:00
Pavel Avgustinov
1248088519 Merge pull request #237 from adityasharad/version/1.18.0-release
Version: Bump to 1.18.0 release.
2018-09-27 11:01:06 +01:00
Ian Lynagh
fd91374b2f C++: Update test output 2018-09-26 18:22:20 +01:00
Aditya Sharad
51697f077c Version: Bump to 1.18.0 release. 2018-09-26 18:18:20 +01:00
Aditya Sharad
40c29263c4 Merge pull request #232 from jbj/resolveElement-member
C++: make `unresolve` a member of ElementBase
2018-09-26 18:09:48 +01:00
Jonas Jensen
3b2512fa0d C++: pragma[nomagic] in Overflow.qll
These two predicates were supposed to be fast but became slow after the
recent inlining of `unresolve`.
2018-09-26 14:39:44 +02:00
Jonas Jensen
6ccd208d4e C++: Prevent incomplete classes from being Types
Raw classes from the database that are incomplete and should be
represented by their complete twin are now allowed to be `Element`s for
performance reasons, but this commit prevents them from being `Type`s.
It was causing confusion in test results and might also cause confusion
in queries.
2018-09-26 14:02:15 +02:00
Jonas Jensen
0e0ab1ea97 C++: make unresolve a member of ElementBase
Also remove the charpred of ElementBase. This gets rid of many redundant
charpred checks. It means that incomplete classes from the db are now
`Element`s, which is maybe noisy but should not be harmful.

Together, these changes give a great reduction in DIL and should help
the optimiser. It brings the DIL of `UncontrolledFormatString.ql` down
from 43,908 lines to 35,400 lines.
2018-09-26 11:12:40 +02:00
Jonas Jensen
3470ebc583 Merge pull request #223 from pavgust/imp/no-instantiation-mentions
C++ definitions: Ignore type mentions of class inatantiations.
2018-09-25 09:31:10 +02:00
Pavel Avgustinov
fa698380e2 C++ definitions: Ignore type mentions of class inatantiations.
We currently erroneously keep mentions of class instantiations, which
can lead to bad performance on template-heavy code bases. We never
want to link those anyway, so we can simply suppress them.
2018-09-24 18:18:30 +01:00
ian-semmle
4b0ab602e7 Merge pull request #202 from jbj/resolveClass-conservative
C++: more conservative resolveClass
2018-09-19 11:35:45 +01:00
Jonas Jensen
dca93f58cc Merge pull request #196 from pavgust/fix/param-effective-decl-entry
Parameter.qll: Tweak how effective declaration entries are computed
2018-09-18 09:37:23 +02:00
Jonas Jensen
a7d897108a C++: Exclude non-toplevel items from resolveClass
Also exclude templates as their names are not canonical.

The test changes in `isfromtemplateinstantiation/` are the inverses of
what we got in 34c9892f7, which should be a good thing.
2018-09-17 15:55:34 +02:00
Jonas Jensen
d7f442b042 C++: Force unique resolveClass results 2018-09-17 15:52:38 +02:00
Jonas Jensen
b633ee1bc4 C++: Add more tests of resolveClass
These tests exercise the problematic cases where a variable can appear
to have multiple types because of how we fail to account for qualified
names when comparing type names.
2018-09-17 15:48:02 +02:00
Pavel Avgustinov
2b4da8d6a7 Parameter.qll: Tweak how effective declaration entries are computed
With the new formulation, we can join on function and index at the
same time, leading to significant performance gains on large code
bases that use templates extensively.
2018-09-14 12:22:01 +01:00
Dave Bartolomeo
c9cb2a0d14 Merge pull request #177 from jbj/ir-array-init-perf
C++: IR: Fix performance of value-init ranges
2018-09-14 00:14:45 -07:00
Geoffrey White
1459b981f3 Merge pull request #183 from jbj/unsafe-strcat-perf
C++: Restructure UnsafeUseOfStrcat for performance
2018-09-12 15:16:58 +01:00
Asger F
cc6edd4e23 Merge pull request #182 from felicity-semmle/1.18/js-change-notes
LGTM 1.18: finalize the JavaScript change notes
2018-09-12 14:00:42 +01:00
Jonas Jensen
9fb5fbd995 C++: Restructure UnsafeUseOfStrcat for performance
This query gets optimized badly, and it has started timing out when we
run it on our own code base. Most of the evaluation time is spent in an
RA predicate named `#select#cpe#1#f#antijoin_rhs#1`, which takes 1m36s a
Wireshark snapshot.

This restructuring of the code makes the problematic RA predicate go
away.
2018-09-12 09:37:17 +02:00
Felicity Chapman
4d512a5b01 Remove non-LGTM query (see following PR) 2018-09-11 22:54:37 +01:00
Felicity Chapman
7dd891d908 Further updates and addition of query @ids 2018-09-11 22:51:14 +01:00
Felicity Chapman
223bf6cf56 Updates for consistency 2018-09-11 22:31:32 +01:00
Jonas Jensen
df948ecbbc C++: IR: designated initializer test 2018-09-11 19:43:02 +02:00
semmle-qlci
b17aeb689c Merge pull request #118 from esben-semmle/js/request-forgery
Approved by asger-semmle
2018-09-11 16:28:59 +01:00