Commit Graph

41418 Commits

Author SHA1 Message Date
Tom Hvitved
5ce9b25ec9 C#: Improve CFG for assignments
Write accesses in assignments, such as the access to `x` in `x = 0` are not
evaluated, so they should not have entries in the control flow graph. However,
qualifiers (and indexer arguments) should still be evaluated, for example in

```
x.Foo.Bar = 0;
```

the CFG should be `x --> x.Foo --> 0 --> x.Foo.Bar = 0` (as opposed to
`x --> x.Foo --> x.Foo.Bar --> 0 --> x.Foo.Bar = 0`, prior to this change).

A special case is assignments via acessors (properties, indexers, and event
adders), where we do want to include the access in the control flow graph,
as it represents the accessor call:

```
x.Prop = 0;
```

But instead of `x --> x.set_Prop --> 0 --> x.Prop = 0` the CFG should be
`x --> 0 --> x.set_Prop --> x.Prop = 0`, as the setter is called *after* the
assigned value has been evaluated.

An even more special case is tuple assignments via accessors:

```
(x.Prop1, y.Prop2) = (0, 1);
```

Here the CFG should be
`x --> y --> 0 --> 1 --> x.set_Prop1 --> y.set_Prop2 --> (x.Prop1, y.Prop2) = (0, 1)`.
2019-02-16 19:19:24 +01:00
yh-semmle
ca3aaa8c75 Java: add change note for additional framework support 2019-02-15 20:01:08 -05:00
yh-semmle
64b2d331ae Java: add test for Guice framework support 2019-02-15 20:01:08 -05:00
yh-semmle
b0d9c80ccc Java: add taint steps for Protobuf framework 2019-02-15 20:01:07 -05:00
yh-semmle
fc4aa16905 Java: add remote user input for Apache Thrift framework 2019-02-15 20:01:07 -05:00
yh-semmle
751bbbf583 Java: add remote user input for Struts 2 ActionSupport 2019-02-15 20:01:06 -05:00
yh-semmle
a436369846 Java: add remote user input and taint step for Guice framework 2019-02-15 20:01:06 -05:00
Asger F
e7e29101e4 JS: add StringOps::Concatenation 2019-02-15 16:57:26 +00:00
Asger F
c115451b9d JS: Fix copy-pasta bug 2019-02-15 16:48:42 +00:00
Asger F
ab0ed66266 JS: Add EndsWith::Range 2019-02-15 16:48:15 +00:00
Asger F
2ccfd73be5 JS: Add Includes::Range 2019-02-15 16:42:41 +00:00
Asger F
56e081f7c9 JS: Add StartsWith::Range 2019-02-15 16:38:18 +00:00
Asger F
1aba111a00 JS: Use ::Range pattern for abstract classes 2019-02-15 14:28:07 +00:00
Asger F
c8823fa7cf JS: change charpred of ClosureModule to be AST-based 2019-02-15 14:28:06 +00:00
Asger F
d1607f7c47 JS: remove SourceNode supertype from ClosureNamespaceAccess 2019-02-15 14:28:06 +00:00
Asger F
8801431352 JS: elaborate qldoc for isTopLevelExpr 2019-02-15 14:28:06 +00:00
Asger F
fa34f8f414 JS: replace dataflow -> data flow 2019-02-15 14:28:06 +00:00
Asger F
701e662bc4 JS: rename more predicates for consistency 2019-02-15 14:28:06 +00:00
Asger F
23bd9e62f0 JS: Add ClosureNamespaceAccess 2019-02-15 14:28:06 +00:00
Asger F
939eab2c82 JS: refactor expressions to dataflow nodes 2019-02-15 14:28:06 +00:00
Asger F
8d78731ff0 JS: rename getNamespaceId to getClosureNamespace 2019-02-15 14:28:06 +00:00
Robin Neatherway
5754eb666c Merge pull request #942 from esben-semmle/emacs-1
Emacs syntax highlighting and file-type detection
2019-02-15 14:27:57 +00:00
Asger F
8c96f5f037 JS: tweak global flow for closure modules 2019-02-15 12:05:35 +00:00
Esben Sparre Andreasen
b6f2e60ece emacs: restrict parameterized annotation highlightning 2019-02-15 12:45:36 +01:00
Nick Rolfe
5502627242 Merge pull request #943 from rneatherway/patch-1
Add transient as an annotation
2019-02-15 10:51:05 +00:00
Robin Neatherway
5181bcd0ad Add transient as an annotation 2019-02-15 10:41:17 +00:00
Esben Sparre Andreasen
046c8c963f emacs: generalize parameterized annotation highlightning 2019-02-15 11:35:18 +01:00
Esben Sparre Andreasen
1fd9186428 emacs: initial ql-mode-base.el 2019-02-15 10:00:58 +01:00
Tom Hvitved
096757dadf C#: Add CFG tests for accessor calls 2019-02-14 20:24:04 +01:00
Robert Marsh
26a0f4b100 Merge pull request #938 from dave-bartolomeo/dave/AliasedSSA
C++: Better tracking of SSA memory accesses
2019-02-14 08:10:31 -08:00
Nick Rolfe
6c0dc440ae Merge pull request #940 from aschackmull/cpp/sync-dataflow
CPP/Java: Sync Dataflow
2019-02-14 13:18:35 +00:00
Anders Schack-Mulligen
980a690b8b CPP/Java: Sync Dataflow 2019-02-14 09:59:08 +01:00
Dave Bartolomeo
d8bf3ffe1b C++: Update test expectations 2019-02-13 14:19:57 -08:00
Dave Bartolomeo
b40fd95b8e C++: Better tracking of SSA memory accesses
This change fixes a few key problems with the existing SSA implementations:

For unaliased SSA, we were incorrectly choosing to model a local variable that had accesses that did not cover the entire variable. This has been changed to ensure that all accesses to the variable are at offset zero and have the same type as the variable itself. This was only possible to fix now that every `MemoryOperand` has its own type.

For aliased SSA, we now correctly track the offset and size of each memory access using an interval of bit offsets covered by the access. The offset interval makes the overlap computation more straightforward. Again, this is only possible now that operands have types.
The `getXXXMemoryAccess` predicates are now driven by the `MemoryAccessKind` on the operands and results, instead of by specific opcodes.

This change does fix an existing false negative in the IR dataflow tests.

I added a few simple test cases to the SSA IR tests, covering the various kinds of overlap (MustExcactly, MustTotally, and MayPartially).

I added "PrintSSA.qll", which can dump the SSA memory accesses as part of an IR dump.
2019-02-13 10:44:39 -08:00
Dave Bartolomeo
055485d9eb C++: Work around lack of size for enum type 2019-02-13 10:44:39 -08:00
semmle-qlci
26525fc1b5 Merge pull request #929 from asger-semmle/typescript-no-expansion
Approved by xiemaisi
2019-02-13 18:20:41 +00:00
semmle-qlci
92a6e7e04c Merge pull request #932 from asger-semmle/cookbook-prepare
Approved by xiemaisi
2019-02-13 18:20:09 +00:00
Asger F
dfe3f254de JS: generalize to include default imports 2019-02-13 18:03:57 +00:00
Asger F
d793427630 JS: treat +/- equally in suffix check query 2019-02-13 15:55:19 +00:00
Max Schaefer
5b2df068d3 Merge pull request #921 from asger-semmle/class-node-absval
JS: use type inference to back up function-style classes
2019-02-13 10:12:20 +00:00
Taus
ca6f145b12 Merge pull request #832 from markshannon/python-typesafe-origin
Python: typesafe origin for points-to
2019-02-13 10:55:33 +01:00
semmle-qlci
c422ade739 Merge pull request #927 from xiemaisi/js/ambiguous-id-attr-templates
Approved by esben-semmle
2019-02-13 08:35:41 +00:00
Tom Hvitved
9c287072cf Merge pull request #924 from calumgrant/cs/extractor-string-length
C# extractor: Limit trap strings to 1MB
2019-02-13 09:34:36 +01:00
Tom Hvitved
0cb2c0994a Merge pull request #930 from calumgrant/cs/suppress-alerts
C#: Add some alert suppression comments
2019-02-13 09:34:18 +01:00
semmle-qlci
1d4f894583 Merge pull request #931 from aschackmull/java/autoformat
Approved by esben-semmle, hvitved, yh-semmle
2019-02-13 08:30:25 +00:00
Robert Marsh
f0cf576e3b Merge pull request #935 from dave-bartolomeo/dave/PointerDecay
C++: Handle pointer decay and inferred array sizes
2019-02-12 15:03:21 -08:00
Dave Bartolomeo
aff2ea3316 C++: Handle pointer decay and inferred array sizes
For function parameters that are subject to "pointer decay", the database contains the type as originally declared (e.g. `T[]` instead of `T*`). The IR needs the actual type. Similarly, for variable declared as an array of unknown size, the actual size needs to be inferred from the initializer (e.g. `char a[] = "blah";` needs to have the type `char[5]`).

I've opened a ticket to have the extractor emit the actual type alongside the declared type, but for now, this workaround is enough to unblock progress for typical code.
2019-02-12 12:41:21 -08:00
Robert Marsh
6ab0eaac7d Merge pull request #926 from dave-bartolomeo/dave/MemoryOperand
C++: Rationalize `RegisterOperand` vs. `MemoryOperand`
2019-02-12 12:18:02 -08:00
Dave Bartolomeo
f5121d71bc C++: Fix range analysis for new API 2019-02-12 09:38:11 -08:00
Asger F
d532815efe JS: remove unused predicate 2019-02-12 17:34:21 +00:00