717 Commits

Author SHA1 Message Date
Geoffrey White
beb21f92d3 CPP: Separate the dataflow case from dynamic allocation. 2018-10-08 15:45:17 +01:00
Geoffrey White
ef8ca5de58 CPP: Replace def-use with dataflow in getBufferSize. 2018-10-08 15:45:17 +01:00
Geoffrey White
c747f24b39 CPP: Fix the initialized array case in getBufferSize. 2018-10-08 15:45:17 +01:00
Tom Hvitved
ccebd5eb11 Merge remote-tracking branch 'upstream/master' into mergeback-2018-10-08 2018-10-08 16:23:29 +02:00
Pavel Avgustinov
2904ebb8a3 Merge pull request #291 from jbj/mergeback-20181008
Mergeback rc/1.18 to master
2018-10-08 13:56:50 +01:00
Jonas Jensen
4e25929f82 Merge pull request #288 from geoffw0/widechartype
CPP: Address Widechartype / WChar_t
2018-10-08 13:46:28 +02:00
Tom Hvitved
49644bfb47 Merge remote-tracking branch 'upstream/master' into mergeback-2018-10-08 2018-10-08 11:48:56 +02:00
Jonas Jensen
799c034a5e Merge pull request #282 from rdmarsh2/rdmarsh/cpp/simple-range-analysis-caching
C++: add cached module to SimpleRangeAnalysis
2018-10-08 11:44:35 +02:00
Jonas Jensen
628540cf7b Merge remote-tracking branch 'upstream/rc/1.18' into mergeback-20181008 2018-10-08 09:55:31 +02: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
Geoffrey White
e0140f9112 CPP: Change some uses of WideCharType to Wchar_t. 2018-10-05 22:03:47 +01:00
Geoffrey White
ecf8e5d936 CPP: Add backticks. 2018-10-05 21:42:16 +01:00
Geoffrey White
d649835f45 CPP: Add an explanatory comment on WideCharType and Wchar_t. 2018-10-05 21:41:35 +01:00
Robert Marsh
c0cf16ab2e C++: move expr predicactes to cached module 2018-10-05 09:34:16 -07:00
Geoffrey White
99816d77e3 CPP: Additional test case fixed in combination with typedef work. 2018-10-05 17:13:50 +01:00
Geoffrey White
67a7b75b84 CPP: Simplify getAFormatterWideType. 2018-10-05 16:40:54 +01:00
Geoffrey White
605db444a6 CPP: Fix for consistency. 2018-10-05 16:40:54 +01:00
Geoffrey White
94ff2e5693 CPP: Lets just not report when we're not sure. 2018-10-05 16:40:54 +01:00
Geoffrey White
2841897e3a CPP: Make getAFormatterWideType more general and move it into FormattingFunction.qll. 2018-10-05 16:40:54 +01:00
Geoffrey White
580471ab1d CPP: Replace stripTopLevelSpecifiers to emulate old behaviour. 2018-10-05 16:40:54 +01:00
Geoffrey White
89c56486b5 CPP: Test getDefaultCharType etc. 2018-10-05 16:40:54 +01:00
Geoffrey White
e2be19b555 CPP: New mechanism for string types in printf.qll. 2018-10-05 16:40:54 +01:00
Geoffrey White
1af6c10888 CPP: Add a test where different word sizes are present. 2018-10-05 16:40:54 +01:00
Geoffrey White
800555865a CPP: More test cases. 2018-10-05 16:40:54 +01:00
Geoffrey White
2af56b89b1 CPP: Add a test where different wide types are present. 2018-10-05 15:32:36 +01:00
Geoffrey White
39f030b8f7 CPP: Annotate test. 2018-10-05 15:32:36 +01:00
Geoffrey White
e74721e3a4 CPP: Test fixes as a result of changes. 2018-10-05 15:32:36 +01:00
Geoffrey White
6e5207ce3c CPP: Allow declarations of library printf functions in source (repairs most of the tests). 2018-10-05 15:32:36 +01:00
Robert Marsh
fe8f7e9624 C++: consider attributes when finding wide string functions 2018-10-05 15:32:36 +01:00
Robert Marsh
5b8925c699 C++: document new predicate 2018-10-05 15:32:36 +01:00
Robert Marsh
a3459ddf08 C++: add support for custom wide character sizes
Certain Microsoft projects, such as CoreCLR and ChakraCore, use a
library called the PAL, which enables two-byte strings in the printf
family of functions, even when built on a platform with four-byte
strings. This adds support for determining the size of a wide character
from the definitions of such functions, rather than assuming that they
match the compiler's wchar_t.
2018-10-05 15:32:35 +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
Robert Marsh
f3539e472c C++: add cached module to SimplerangeAnalysis 2018-10-04 15:25:10 -07:00
Jonas Jensen
4720c5ab60 Merge pull request #264 from raulgarciamsft/users/raulga/c6276
C++: incorrect string type conversion
2018-10-04 21:06:07 +02:00
Robert Marsh
d6f6d67c13 Merge pull request #281 from kevinbackhouse/GlobalValueNumberingBugFix
Workaround for getFullyConverted returning multiple results.
2018-10-04 09:54:36 -07:00
Kevin Backhouse
6df9bc855a Workaround for getFullyConverted returning multiple results. 2018-10-04 15:40:18 +01: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
semmle-qlci
30412caa16 Merge pull request #276 from jbj/PointlessComparison-templates
Approved by kevinbackhouse
2018-10-04 12:34:52 +01:00
Raul Garcia
3873cbdde0 Chnaging the @name & @description. 2018-10-03 15:32:34 -07:00
Jonas Jensen
9c0ba51873 C++: Make cpp/missing-return visible on LGTM again 2018-10-03 15:02:15 +02:00
Jonas Jensen
364c9a6961 C++: Suppress pointless compare in template inst.
It still runs on uninstantiated templates because its underlying
libraries do. It's not clear whether that leads to other false
positives, but that's independent of the change I'm making here.
2018-10-03 14:48:11 +02:00
Jonas Jensen
2eea359f79 C++: Test for PointlessComparison with templates 2018-10-03 14:47:00 +02:00
Jonas Jensen
4ad4b19911 Merge pull request #189 from geoffw0/wrongtypedef
CPP: Permit more typedefs in WrongTypeFormatArguments.ql
2018-10-03 09:40:06 +02:00
Raul Garcia
492b511cdf Merge operation 2018-10-02 11:27:39 -07:00
Raul Garcia
230724c085 Updates based on feedback 2018-10-02 11:17:23 -07:00
Tobias Smolka
51dcdeff59 C++: support Decltype in suspicious-call-to-memset 2018-10-02 16:47:04 +02:00
Raul Garcia
99e6708b2b Merge branch 'master' into users/raulga/c6276 2018-10-01 10:28:54 -07:00
Raul Garcia
253b8d1287 C++ : cpp/incorrect-string-type-conversion
Cast between semantically different string types: char* from/to wchar_t*
NOTE: Please let me know if you want to use a different CWE than CWE-704
2018-10-01 10:25:49 -07:00
Aditya Sharad
337defdf3d Merge master into next. 2018-10-01 17:39:27 +01:00