Commit Graph

3562 Commits

Author SHA1 Message Date
Chris Gavin
53dbc0ad71 Merge rc/1.24 into master. 2020-04-17 09:36:09 +01:00
Mathias Vorreiter Pedersen
86ba03bea8 Merge pull request #3256 from Semmle/rdmarsh/cpp/add-qldoc-1
C++: Add QLdoc to some AST methods (Class.qll-Diagnostics.qll)
2020-04-15 21:46:36 +02:00
Jonas Jensen
aa8f30cd83 Merge pull request #3268 from MathiasVP/ql-doc-negativitiy
C++: Add QLDoc to public predicates in Negativity.qll
2020-04-15 15:12:07 +02:00
Mathias Vorreiter Pedersen
3d0ac53266 Apply suggestions from code review
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-04-15 14:01:49 +02:00
Geoffrey White
2aa64db40e Merge remote-tracking branch 'upstream/rc/1.24' into alloc-size2 2020-04-15 10:09:54 +01:00
Mathias Vorreiter Pedersen
a2fbe9e9da C++: Add QLDoc to public predicates in Negativity 2020-04-15 08:18:03 +02:00
Jonas Jensen
b603a3da64 Merge pull request #3259 from MathiasVP/ql-doc-fileclosed-loopbounds-memoryfreed
C++: QLDoc for FileClosed, LoopBounds and MemoryFreed
2020-04-15 08:08:04 +02:00
Jonas Jensen
6eac35c753 Merge pull request #3264 from Semmle/merge-rc/1.24
Merge rc/1.24 into master.
2020-04-15 07:56:58 +02:00
Jonas Jensen
ae11e7b72c Merge pull request #3265 from Semmle/rdmarsh/cpp/deprecate-isDefined
C++: deprecate Declaration::isDefined()
2020-04-15 07:53:19 +02:00
Chris Gavin
4e981d8e70 Merge rc/1.24 into master. 2020-04-14 21:30:29 +01:00
Robert Marsh
146bfca2ad Merge pull request #3254 from dbartol/dbartol/ImplicitReturnValue2
C++: Treat implicit end of body of non`-void` function as `Unreached`
2020-04-14 12:18:50 -07:00
Dave Bartolomeo
279467654e C++: Make test functions return void 2020-04-14 14:17:56 -04:00
Dave Bartolomeo
812087968f C++: Fix test output
Mostly noise, but a couple of the missing operand errors are actual fixes.
2020-04-14 14:17:20 -04:00
Robert Marsh
b5c0a0f77d C++: remove all uses of Declaration::isDefined 2020-04-14 10:54:06 -07:00
Robert Marsh
5ee60762fe C++: deprecate Declaration::isDefined() 2020-04-14 10:49:52 -07:00
Robert Marsh
7f5b3de665 C++: autoformat 2020-04-14 10:36:53 -07:00
Mathias Vorreiter Pedersen
092145d571 Update cpp/ql/src/Critical/FileClosed.qll
Co-Authored-By: Jonas Jensen <jbj@github.com>
2020-04-14 18:38:33 +02:00
Dave Bartolomeo
125a09ce6e C++: Fix IR generation of return of void expression 2020-04-14 11:40:33 -04:00
Dave Bartolomeo
83cd78c6cf C++: Fix test output 2020-04-14 10:54:00 -04:00
Felicity Chapman
c570ebe5bd Merge branch 'rc/1.24' into update-references 2020-04-14 14:10:26 +01:00
Mathias Vorreiter Pedersen
419b511ddb C++: Format 2020-04-14 11:39:44 +02:00
Mathias Vorreiter Pedersen
d8dcbe3cbd C++: QLDoc for FileClosed, LoopBounds and MemoryFreed 2020-04-14 10:21:11 +02:00
Robert Marsh
10824f9612 C++: add method qldoc in Class.qll 2020-04-13 15:49:37 -07:00
Dave Bartolomeo
1bde11706e C++: Connect InitializeIndirection to UnmodeledDefinition
The IR generation for `InitializeIndirection` currently connects its load operand to the result of the corresponding `InitializeParameter` instruction. This isn't exactly wrong, but it doesn't fit the IR invariant of "All unmodeled uses consume `UnmodeledDefinition`". Our current code doesn't care, because we just throw away all of the existing def-use information, modeled or otherwise, when we build unaliased SSA. However, some upcoming SSA changes don't work correctly if this invariant is broken.

I've added the trivial IR generation change, along with a new sanity query.
2020-04-13 18:37:47 -04:00
Dave Bartolomeo
603a3af19b C++: Treat implicit end of body of non-void function as Unreached
When the extractor can't prove that control flow will never reach the end of a non-`void`-returning function without reaching an explicit `return` statement, it inserts an implicit `return` without an operand. If control actually reaches this point, the behavior is undefined.

We were previously generating invalid IR for these implicit `return` statements, because the lack of an operand meant that there was no definition of the return value variable along that path. Instead, I've changed the IR generation to emit an `Unreached` instruction for the implicit `return`. This ensures that we don't create a control flow edge from the end of the body to the function epilogue.

The change to the range analysis test avoids having that test depend on the previous bad IR behavior, while still preserving the original spirit of the test.
2020-04-13 18:09:44 -04:00
Robert Marsh
f24c4e51c5 C++: add method qldoc in Diagnostics.qll 2020-04-13 14:58:30 -07:00
Robert Marsh
d065389a6b C++: add method commetns in Compilation.qll 2020-04-13 14:41:25 -07:00
Robert Marsh
de29d93ede C++: add method qldoc for Comment.qll 2020-04-13 14:39:51 -07:00
Robert Marsh
8779177839 C++: accept minor test change 2020-04-13 14:03:02 -07:00
Robert Marsh
a5e7db73b2 Merge branch 'rc/1.24' into rdmarsh/cpp/ir-flow-through-outparams
For submodule consistency
2020-04-13 12:02:59 -07:00
Dave Bartolomeo
9f18a15a93 Merge pull request #3231 from MathiasVP/qualified-static-calls-are-static
C++: Do not generate this parameters and read/write side effects from static member functions
2020-04-09 10:48:59 -04:00
Pavel Avgustinov
6737e99d65 Merge pull request #3209 from hmakholm/baselib-extractor
Add extractor field in base language QL packs
2020-04-09 15:24:49 +01:00
Geoffrey White
ba3a8d0872 C++: Improve naming and QLDoc. 2020-04-09 15:06:23 +01:00
Geoffrey White
a7979fdc12 C++: Base results purely on allocations now, not multiplications by a sizeof. 2020-04-09 15:05:29 +01:00
Geoffrey White
febbbc4423 C++: Additional test cases. 2020-04-09 15:03:35 +01:00
Mathias Vorreiter Pedersen
0c5bca8f4e C++: Replace underscores with dashes in query @id 2020-04-09 12:09:15 +02:00
Mathias Vorreiter Pedersen
6c7e1cdd46 C++: Make sure non-member functions are not reported to have a qualifier 2020-04-09 08:22:47 +02:00
Robert Marsh
3b591183c9 C++: remove partial flow from UnknownType 2020-04-08 17:09:30 -07:00
Robert Marsh
1199ff92e8 C++: autoformat 2020-04-08 16:41:29 -07:00
Robert Marsh
7e299e7494 C++/C#: Document ReturnIndirectionInstruction::getParameter 2020-04-08 16:41:07 -07:00
Robert Marsh
b37c13de91 C++: restore flow for non-class partial reads
This would otherwise have lost a good qltest result at
CWE-134/semmle/funcs/funcsLocal.c:58:9:58:10
2020-04-08 16:30:45 -07:00
Jonas Jensen
9f40886af9 C++: Don't allow taint out of a field read
except if it's from a union. This prevents field conflation through
buffers of `UnknownType`.
2020-04-08 14:02:33 -07:00
Robert Marsh
a0b26d66a4 C++: remove partial flow to IR loads 2020-04-08 13:56:56 -07:00
Robert Marsh
c38ccaaab6 Merge branch 'master' into rdmarsh/cpp/ir-flow-through-outparams 2020-04-08 12:32:35 -07:00
Mathias Vorreiter Pedersen
7298b68674 C++: Exclude 'this' params and read/write side effects from static member function calls through qualifiers, and accept tests 2020-04-08 13:35:26 +02:00
Mathias Vorreiter Pedersen
e4e0d3b573 C++: Add test cases showing that static member function calls get 'this' pointers and side effects for 'this' when accessed through qualifiers 2020-04-08 13:00:51 +02:00
Felicity Chapman
eb89851025 Merge branch 'master' into update-references 2020-04-08 11:48:13 +01:00
Mathias Vorreiter Pedersen
b2759877cc Merge pull request #3219 from jbj/DefaultTaintTracking-partial-no-structs
C++: Avoid partial chi flow to struct/class
2020-04-08 12:31:53 +02:00
Felicity Chapman
dacbc1376c Update some out of date information 2020-04-08 10:36:04 +01:00
Jonas Jensen
6726a23c31 Merge pull request #3221 from disconnect3d/patch-1
Fix missing colon in ReturnConstTypeMember.cpp
2020-04-08 11:22:31 +02:00