Harry Maclean
2822c94aa7
Ruby: Minor refactor of barrier guard code
2022-11-25 09:12:51 +13:00
Harry Maclean
6897fb46cb
Ruby: Clean up WhenClause CFG
2022-11-25 09:12:51 +13:00
Harry Maclean
57f689401e
Ruby: SplatExprCfgNode extends UnaryOperationCfgNode
2022-11-24 17:33:57 +13:00
Harry Maclean
376d4e03a1
Ruby: Cache some barrier guard predicates
2022-11-18 18:17:02 +13:00
Harry Maclean
5deb16e58c
Ruby: Remove redundant predicate
...
The existing barrier guard machinery recognises guards such as `if x and y`,
so there's no need to explicitly model them.
2022-11-18 18:14:55 +13:00
Tom Hvitved
f24fa402f3
Adjust CFG
2022-11-17 10:32:28 +01:00
Harry Maclean
2b4217b8a4
Ruby: Update test fixture
2022-11-11 18:41:55 +13:00
Harry Maclean
b16cecc8db
Ruby: Add missing doc
2022-11-11 18:41:42 +13:00
Harry Maclean
62ea1f0a05
Ruby: Fix performance of string comparison guard
...
The `or` case ran extremely slowly before this change. Also exclude
string interpolations from consideration, for correctness, and add some
more tests.
2022-11-11 18:24:20 +13:00
Harry Maclean
e25e192ef3
Ruby: Change the CFG for while clauses
...
The `when` node now acts as a join point for patterns in the when
clause, with match/no-match completions. This is similar to how `or`
expressions work.
The result of this is that the `when` clause "controls" the body of the
`when`, which allows us to model barrier guards for multi-pattern when
clauses.
For this code
case x
when 1, 2
y
end
The old CFG was
x --> when --> 1 --no-match--> 2 ---no-match---> case
\ \ ^
\ \ |
\ --match----+ |
\ | |
\ | |
------match---------> y --+
The new CFG is
x --> 1 --no-match--> 2 --no-match--> [no-match] when --no-match--> case
\ \ ^
\ \ |
\ --match--> [match] when --match--> y -----+
\ /
\ /
-------match-----
i.e. all patterns flow to the `when` node, which is split based on
whether the pattern matched or not. The body of the when clause then has
a single predecessor `[match] when`, which acts as condition block that
controls `y`.
2022-11-11 11:52:27 +13:00
Harry Maclean
a8b0d298ff
Ruby: More string comparison guards
...
Recognise if statements with conditionals made up or logical `and` or
`or` clauses as barrier guards.
2022-11-10 16:38:09 +13:00
Harry Maclean
ad7b5ae7ed
Ruby: Add inline barrier guard test
2022-11-09 16:35:28 +13:00
Harry Maclean
f1b63c4df3
Ruby: Fix in clause barrier guard
2022-11-09 16:10:17 +13:00
Harry Maclean
0ab88c2e29
Ruby: Handle simple in clauses in barrier guard
2022-11-09 16:01:33 +13:00
Harry Maclean
87944a3a75
Ruby: Add test for another case guard variant
2022-11-09 15:05:03 +13:00
Harry Maclean
25ceeaf241
Ruby: Fix SplatExprCfgNode
2022-11-09 15:03:15 +13:00
Harry Maclean
4bc9096446
Ruby: Add case string comparison barrier guard
...
This recognises barriers of the form
STRINGS = ["foo", "bar"]
case foo
when "some string literal"
foo
when *["other", "strings"]
foo
when *STRINGS
foo
end
where the reads of `foo` inside each `when` are guarded by the comparison
of `foo` with the string literals.
We don't yet recognise this construct:
case foo
when "foo", "bar"
foo
end
This is due to a limitation in the shared barrier guard logic.
2022-11-09 15:03:13 +13:00
Jami
cfbaf5e53b
Merge pull request #10785 from jcogs33/insuff-key-size-globalflow-keysize
...
Java: Promote insufficient key size query from experimental
2022-11-08 18:05:01 -05:00
Paolo Tranquilli
53b7584a90
Merge pull request #11169 from github/redsun82/swift-extract-last-stmts
...
Swift: extract remaining `Stmt`s
2022-11-08 20:51:10 +01:00
Paolo Tranquilli
7939b84380
Merge pull request #11168 from github/redsun82/swift-postfix-expr
...
Swift: extract `PostfixUnaryExpr`
2022-11-08 20:50:45 +01:00
Jeroen Ketema
6a5f37b1b7
Merge pull request #11149 from geoffw0/wrong-number-msg
...
C++: Clearer messages for the format args queries
2022-11-08 20:44:10 +01:00
Erik Krogh Kristensen
8b11e98d42
Merge pull request #11162 from erik-krogh/ciCache
...
CI: try only to fill the compilation cache from main in the compile-queries workflow
2022-11-08 19:24:14 +01:00
Paolo Tranquilli
cbae72d9da
Swift: remove emoji in test
2022-11-08 17:41:40 +01:00
Paolo Tranquilli
9ee4f8b388
Swift: extract remaining Stmts
...
`FailStmt` are `return nil` in fallible initializers.
`PoundAssertStmt` are an experimental feature for compile time
assertions.
2022-11-08 17:38:17 +01:00
Mathias Vorreiter Pedersen
4cdcebf022
Merge pull request #11161 from geoffw0/localflowsource
...
Swift: Add LocalFlowSource class and a few sources.
2022-11-08 16:12:32 +00:00
Paolo Tranquilli
00d3ff8a18
Swift: extract UnaryPostfixExpr
2022-11-08 17:10:33 +01:00
AlexDenisov
6fb021a5bc
Merge pull request #11164 from github/redsun82/swift-print-unextracted
...
Swift: print unextracted entities
2022-11-08 16:07:44 +01:00
Jeroen Ketema
2bef82babc
Merge pull request #11163 from jketema/missing-return
...
C++: Add dataflow test that deliberately omits the return of a non-void function
2022-11-08 16:00:36 +01:00
Geoffrey White
c8426776fc
Merge branch 'main' into wrong-number-msg
2022-11-08 14:47:19 +00:00
Paolo Tranquilli
d325a42890
Swift: print unextracted entities
2022-11-08 15:38:53 +01:00
Jeroen Ketema
d93bda21c2
Merge pull request #11159 from jketema/strcat-return-deref-taint
...
C++: Also taint the return value dereference in the `strcat` model
2022-11-08 15:27:07 +01:00
Jeroen Ketema
fa2d58adff
C++: Add dataflow test that deliberately omits the return of a non-void function
2022-11-08 15:12:34 +01:00
erik-krogh
22d7f3cfe5
try only to fill the cache from main
2022-11-08 15:06:00 +01:00
Geoffrey White
25b4296045
Swift: Rename predicate to avoid confusion.
2022-11-08 13:52:33 +00:00
Geoffrey White
24c8f1d8b5
Swift: Add some local (and remote) flow sources for String.
2022-11-08 13:38:25 +00:00
Erik Krogh Kristensen
e01cbb2ffa
Merge pull request #10378 from erik-krogh/aliasFlow
...
JS: expand localFieldStep to use access-paths, and build access-paths in more cases
2022-11-08 14:26:12 +01:00
Geoffrey White
e669754d0b
Swift: Also add local flow sources to summary queries.
2022-11-08 13:05:41 +00:00
Geoffrey White
be05b807cd
Swift: Add models-as-data local flow sources as well.
2022-11-08 13:05:41 +00:00
Geoffrey White
0dcb5546a1
Swift: Add a LocalFlowSource and FlowSource class.
2022-11-08 13:05:41 +00:00
Geoffrey White
c5285acb04
Swift: Add more tests for String flow sources.
2022-11-08 13:05:40 +00:00
Paolo Tranquilli
552c5249ac
Merge pull request #11131 from github/redsun82/swift-incomplete-ast
...
Swift: deal with incomplete ASTs
2022-11-08 14:01:58 +01:00
Tom Hvitved
f0554fcdee
Merge pull request #11155 from hvitved/ruby/avoid-stage-recomputation
...
Ruby: Avoid stage recomputation
2022-11-08 13:46:53 +01:00
Tom Hvitved
edde3defed
Merge pull request #11153 from hvitved/ruby/basic-block-at-conditions
...
Ruby: Split basic blocks around constant conditionals
2022-11-08 13:35:52 +01:00
Tony Torralba
d813590780
Merge pull request #11156 from atorralba/atorralba/swift/bitwise-operation
...
Swift: Add `BitwiseOperation.qll`
2022-11-08 12:15:00 +01:00
Jeroen Ketema
c61a9c5911
C++: Also taint the return value dereference in the strcat model
2022-11-08 12:08:44 +01:00
Paolo Tranquilli
9731048836
Swift: remove an assert from swift headers
...
An interesting byproduct was finding a problematic `assert` in the
Swift headers. An incomplete `FallthroughStmt` was asserting on having
a destination. I did not find any other sensible way of getting rid of
the crash when running in debug mode than to patch the header.
2022-11-08 11:47:12 +01:00
Paolo Tranquilli
fda9d19a97
Swift: replace undefined labels with UnspecifiedElement
2022-11-08 11:47:12 +01:00
Paolo Tranquilli
8d3e6ff8a7
Swift: add label iteration
2022-11-08 11:47:12 +01:00
Paolo Tranquilli
450a4a04af
Swift: add incomplete ast test
...
The test was inspired by locally running the query against files in
https://github.com/apple/swift/tree/main/test/Parse
A query for missing elements was also added to the AST tests, expecting
nothing to be found.
2022-11-08 11:46:07 +01:00
Paolo Tranquilli
d6fb6bf036
Swift: customize UnspecifiedElement
2022-11-08 11:40:27 +01:00