Skip to content

Commit 938e962

Browse files
committed
Merge remote-tracking branch 'upstream/main' into aibaars/rust-comments
2 parents d3c5072 + d0831eb commit 938e962

File tree

101 files changed

+692
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+692
-201
lines changed

java/ql/lib/ext/java.lang.model.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ extensions:
200200
- ["java.lang", "ClassLoader", "loadClass", "(String,boolean)", "summary", "df-manual"]
201201
- ["java.lang", "ClassLoader", "setClassAssertionStatus", "(String,boolean)", "summary", "df-manual"]
202202
- ["java.lang", "ClassLoader", "setPackageAssertionStatus", "(String,boolean)", "summary", "df-manual"]
203+
- ["java.lang", "Comparable", "compareTo", "", "summary", "manual"]
203204
- ["java.lang", "Enum", "Enum", "(String,int)", "summary", "manual"]
204205
- ["java.lang", "Enum", "equals", "(Object)", "summary", "manual"]
205206
- ["java.lang", "Enum", "hashCode", "()", "summary", "manual"]

java/ql/lib/ext/java.util.model.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ extensions:
362362
- ["java.util", "SequencedMap", True, "sequencedValues", "", "", "Argument[this].MapValue", "ReturnValue.Element", "value", "manual"]
363363
- ["java.util", "SequencedSet", True, "reversed", "", "", "Argument[this].Element", "ReturnValue.Element", "value", "manual"]
364364
- ["java.util", "Set", False, "copyOf", "(Collection)", "", "Argument[0].Element", "ReturnValue.Element", "value", "manual"]
365-
- ["java.util", "Set", False, "clear", "()", "", "Argument[this].WithoutElement", "Argument[this]", "value", "manual"]
365+
- ["java.util", "Set", True, "clear", "()", "", "Argument[this].WithoutElement", "Argument[this]", "value", "manual"]
366366
- ["java.util", "Set", False, "of", "(Object)", "", "Argument[0]", "ReturnValue.Element", "value", "manual"]
367367
- ["java.util", "Set", False, "of", "(Object,Object)", "", "Argument[0..1]", "ReturnValue.Element", "value", "manual"]
368368
- ["java.util", "Set", False, "of", "(Object,Object,Object)", "", "Argument[0..2]", "ReturnValue.Element", "value", "manual"]
@@ -430,6 +430,8 @@ extensions:
430430
- ["java.util", "Collection", "contains", "(Object)", "summary", "manual"]
431431
- ["java.util", "Collection", "containsAll", "(Collection)", "summary", "manual"]
432432
- ["java.util", "Collection", "isEmpty", "()", "summary", "manual"]
433+
- ["java.util", "Collection", "remove", "(Object)", "summary", "manual"]
434+
- ["java.util", "Collection", "removeIf", "(Predicate)", "summary", "manual"]
433435
- ["java.util", "Collection", "size", "()", "summary", "manual"]
434436
- ["java.util", "Collections", "emptyList", "()", "summary", "manual"]
435437
- ["java.util", "Collections", "emptyMap", "()", "summary", "manual"]
@@ -451,12 +453,14 @@ extensions:
451453
- ["java.util", "HashMap", "size", "()", "summary", "manual"]
452454
- ["java.util", "HashSet", "HashSet", "(int)", "summary", "manual"]
453455
- ["java.util", "Iterator", "hasNext", "()", "summary", "manual"]
456+
- ["java.util", "Iterator", "remove", "()", "summary", "manual"]
454457
- ["java.util", "List", "contains", "(Object)", "summary", "manual"]
455458
- ["java.util", "List", "equals", "(Object)", "summary", "manual"]
456459
- ["java.util", "List", "hashCode", "()", "summary", "manual"]
457460
- ["java.util", "List", "indexOf", "(Object)", "summary", "manual"]
458461
- ["java.util", "List", "isEmpty", "()", "summary", "manual"]
459462
- ["java.util", "List", "of", "()", "summary", "manual"]
463+
- ["java.util", "List", "remove", "(Object)", "summary", "manual"]
460464
- ["java.util", "List", "sort", "(Comparator)", "summary", "manual"]
461465
- ["java.util", "List", "size", "()", "summary", "manual"]
462466
- ["java.util", "Locale$Builder", "addUnicodeLocaleAttribute", "(String)", "summary", "df-manual"]
@@ -535,6 +539,8 @@ extensions:
535539
- ["java.util", "Scanner", "locale", "()", "summary", "df-manual"]
536540
- ["java.util", "Set", "contains", "(Object)", "summary", "manual"]
537541
- ["java.util", "Set", "isEmpty", "()", "summary", "manual"]
542+
- ["java.util", "Set", "remove", "(Object)", "summary", "manual"]
543+
- ["java.util", "Set", "removeAll", "(Collection)", "summary", "manual"]
538544
- ["java.util", "Set", "size", "()", "summary", "manual"]
539545
- ["java.util", "TreeMap", "TreeMap", "(Comparator)", "summary", "df-manual"]
540546
- ["java.util", "TreeSet", "TreeSet", "(Comparator)", "summary", "df-manual"]
@@ -545,14 +551,8 @@ extensions:
545551
- ["java.util", "TimeZone", "getTimeZone", "(String)", "summary", "manual"]
546552
- ["java.util", "Vector", "size", "()", "summary", "manual"]
547553

548-
# The below APIs are currently being stored as neutral models since `WithoutElement` has not yet been implemented for Java.
549-
# When `WithoutElement` is implemented, these should be changed to summary models of the form `Argument[this].WithoutElement -> Argument[this]`.
550-
- ["java.util", "Collection", "removeIf", "(Predicate)", "summary", "manual"]
551-
- ["java.util", "Iterator", "remove", "()", "summary", "manual"]
552-
- ["java.util", "List", "remove", "(Object)", "summary", "manual"]
554+
# The below API is currently being stored as neutral models since `WithoutElement` does not yet have a counterpart for MapValue/MapKey.
553555
- ["java.util", "Map", "clear", "()", "summary", "manual"]
554-
- ["java.util", "Set", "remove", "(Object)", "summary", "manual"]
555-
- ["java.util", "Set", "removeAll", "(Collection)", "summary", "manual"]
556556

557557
# The below APIs have numeric flow and are currently being stored as neutral models.
558558
# These may be changed to summary models with kinds "value-numeric" and "taint-numeric" (or similar) in the future.

java/ql/test/library-tests/dataflow/collections/containerflow.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ models
297297
| 296 | Summary: java.util; SequencedMap; true; sequencedValues; ; ; Argument[this].MapValue; ReturnValue.Element; value; manual |
298298
| 297 | Summary: java.util; SequencedSet; true; reversed; ; ; Argument[this].Element; ReturnValue.Element; value; manual |
299299
| 298 | Summary: java.util; Set; false; copyOf; (Collection); ; Argument[0].Element; ReturnValue.Element; value; manual |
300-
| 299 | Summary: java.util; Set; false; clear; (); ; Argument[this].WithoutElement; Argument[this]; value; manual |
300+
| 299 | Summary: java.util; Set; true; clear; (); ; Argument[this].WithoutElement; Argument[this]; value; manual |
301301
| 300 | Summary: java.util; Set; false; of; (Object); ; Argument[0]; ReturnValue.Element; value; manual |
302302
| 301 | Summary: java.util; Set; false; of; (Object,Object); ; Argument[0..1]; ReturnValue.Element; value; manual |
303303
| 302 | Summary: java.util; Set; false; of; (Object,Object,Object); ; Argument[0..2]; ReturnValue.Element; value; manual |

rust/ql/lib/codeql/rust/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ predicate trivialPat(Pat p) { p instanceof WildcardPat or p instanceof IdentPat
6464
class AsmExprTree extends LeafTree instanceof AsmExpr { }
6565

6666
class AwaitExprTree extends StandardPostOrderTree instanceof AwaitExpr {
67-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
67+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
6868
}
6969

7070
// NOTE: `become` is a reserved but unused keyword.
7171
class BecomeExprTree extends StandardPostOrderTree instanceof BecomeExpr {
72-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
72+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
7373
}
7474

7575
class BinaryOpExprTree extends StandardPostOrderTree instanceof BinaryExpr {
7676
BinaryOpExprTree() { not this instanceof BinaryLogicalOperation }
7777

78-
override ControlFlowTree getChildNode(int i) {
78+
override AstNode getChildNode(int i) {
7979
i = 0 and result = super.getLhs()
8080
or
8181
i = 1 and result = super.getRhs()
@@ -133,7 +133,7 @@ class LogicalAndBinaryOpExprTree extends PreOrderTree, LogicalAndExpr {
133133
}
134134

135135
class BlockExprBaseTree extends StandardPostOrderTree instanceof BlockExpr {
136-
override ControlFlowTree getChildNode(int i) {
136+
override AstNode getChildNode(int i) {
137137
result = super.getStmtList().getStatement(i)
138138
or
139139
not exists(super.getStmtList().getStatement(i)) and
@@ -157,27 +157,27 @@ class BreakExprTree extends PostOrderTree instanceof BreakExpr {
157157
}
158158

159159
class CallExprTree extends StandardPostOrderTree instanceof CallExpr {
160-
override ControlFlowTree getChildNode(int i) {
160+
override AstNode getChildNode(int i) {
161161
i = 0 and result = super.getExpr()
162162
or
163163
result = super.getArgList().getArg(i - 1)
164164
}
165165
}
166166

167167
class CastExprTree extends StandardPostOrderTree instanceof CastExpr {
168-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
168+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
169169
}
170170

171171
class ClosureExprTree extends LeafTree instanceof ClosureExpr { }
172172

173173
class ContinueExprTree extends LeafTree instanceof ContinueExpr { }
174174

175175
class ExprStmtTree extends StandardPreOrderTree instanceof ExprStmt {
176-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
176+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
177177
}
178178

179179
class FieldExprTree extends StandardPostOrderTree instanceof FieldExpr {
180-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
180+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
181181
}
182182

183183
class FunctionTree extends LeafTree instanceof Function { }
@@ -219,7 +219,7 @@ class IfExprTree extends PostOrderTree instanceof IfExpr {
219219
}
220220

221221
class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {
222-
override ControlFlowTree getChildNode(int i) {
222+
override AstNode getChildNode(int i) {
223223
i = 0 and result = super.getBase()
224224
or
225225
i = 1 and result = super.getIndex()
@@ -230,7 +230,7 @@ class IndexExprTree extends StandardPostOrderTree instanceof IndexExpr {
230230
// dominating successors in the graph in the same way that patterns do in
231231
// `match` expressions.
232232
class LetExprTree extends StandardPreOrderTree instanceof LetExpr {
233-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getPat() }
233+
override AstNode getChildNode(int i) { i = 0 and result = super.getPat() }
234234
}
235235

236236
// We handle `let` statements with trivial patterns separately as they don't
@@ -239,7 +239,7 @@ class LetExprTree extends StandardPreOrderTree instanceof LetExpr {
239239
class LetStmtTreeTrivialPat extends StandardPreOrderTree instanceof LetStmt {
240240
LetStmtTreeTrivialPat() { trivialPat(super.getPat()) }
241241

242-
override ControlFlowTree getChildNode(int i) {
242+
override AstNode getChildNode(int i) {
243243
i = 0 and result = super.getInitializer()
244244
or
245245
i = 1 and result = super.getPat()
@@ -370,7 +370,7 @@ class MatchExprTree extends PostOrderTree instanceof MatchExpr {
370370
}
371371

372372
class MethodCallExprTree extends StandardPostOrderTree instanceof MethodCallExpr {
373-
override ControlFlowTree getChildNode(int i) {
373+
override AstNode getChildNode(int i) {
374374
result = super.getReceiver() and
375375
result = super.getArgList().getArg(i + 1)
376376
}
@@ -379,7 +379,7 @@ class MethodCallExprTree extends StandardPostOrderTree instanceof MethodCallExpr
379379
class OffsetOfExprTree extends LeafTree instanceof OffsetOfExpr { }
380380

381381
class ParenExprTree extends StandardPostOrderTree, ParenExpr {
382-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
382+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
383383
}
384384

385385
// This covers all patterns as they all extend `Pat`
@@ -388,25 +388,25 @@ class PatExprTree extends LeafTree instanceof Pat { }
388388
class PathExprTree extends LeafTree instanceof PathExpr { }
389389

390390
class PrefixExprTree extends StandardPostOrderTree instanceof PrefixExpr {
391-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
391+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
392392
}
393393

394394
class RangeExprTree extends StandardPostOrderTree instanceof RangeExpr {
395-
override ControlFlowTree getChildNode(int i) {
395+
override AstNode getChildNode(int i) {
396396
i = 0 and result = super.getStart()
397397
or
398398
i = 1 and result = super.getEnd()
399399
}
400400
}
401401

402402
class RecordExprTree extends StandardPostOrderTree instanceof RecordExpr {
403-
override ControlFlowTree getChildNode(int i) {
403+
override AstNode getChildNode(int i) {
404404
result = super.getRecordExprFieldList().getField(i).getExpr()
405405
}
406406
}
407407

408408
class RefExprTree extends StandardPostOrderTree instanceof RefExpr {
409-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
409+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
410410
}
411411

412412
class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
@@ -424,7 +424,7 @@ class ReturnExprTree extends PostOrderTree instanceof ReturnExpr {
424424
}
425425

426426
class TupleExprTree extends StandardPostOrderTree instanceof TupleExpr {
427-
override ControlFlowTree getChildNode(int i) { result = super.getField(i) }
427+
override AstNode getChildNode(int i) { result = super.getField(i) }
428428
}
429429

430430
class TypeRefTree extends LeafTree instanceof TypeRef { }
@@ -433,10 +433,10 @@ class UnderscoreExprTree extends LeafTree instanceof UnderscoreExpr { }
433433

434434
// NOTE: `yield` is a reserved but unused keyword.
435435
class YieldExprTree extends StandardPostOrderTree instanceof YieldExpr {
436-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
436+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
437437
}
438438

439439
// NOTE: `yeet` is experimental and not a part of Rust.
440440
class YeetExprTree extends StandardPostOrderTree instanceof YeetExpr {
441-
override ControlFlowTree getChildNode(int i) { i = 0 and result = super.getExpr() }
441+
override AstNode getChildNode(int i) { i = 0 and result = super.getExpr() }
442442
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scopeNoFirst
2+
| gen_abi.rs:3:1:6:1 | test_abi |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scopeNoFirst
2+
| gen_arg_list.rs:3:1:6:1 | test_arg_list |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
deadEnd
2+
| gen_array_expr.rs:5:5:5:14 | ExprStmt |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scopeNoFirst
2+
| gen_array_type.rs:3:1:6:1 | test_array_type |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scopeNoFirst
2+
| gen_assoc_item_list.rs:3:1:6:1 | test_assoc_item_list |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scopeNoFirst
2+
| gen_assoc_type_arg.rs:3:1:6:1 | test_assoc_type_arg |

0 commit comments

Comments
 (0)