Skip to content

Commit eab940c

Browse files
committed
Merge branch 'main' into redsun82/kotlin
2 parents 75709bf + 8119a27 commit eab940c

File tree

224 files changed

+37132
-35711
lines changed

Some content is hidden

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

224 files changed

+37132
-35711
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.1.0
1+
7.1.2
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
description: Revert support for repeated initializers, which are allowed in C with designated initializers.
22
compatibility: full
3-
aggregate_field_init.rel: reorder aggregate_field_init.rel (int aggregate, int initializer, int field, int position) aggregate initializer field
4-
aggregate_array_init.rel: reorder aggregate_array_init.rel (int aggregate, int initializer, int element_index, int position) aggregate initializer element_index
3+
aggregate_field_init.rel: reorder aggregate_field_init.rel (@aggregateliteral aggregate, @expr initializer, @membervariable field, int position) aggregate initializer field
4+
aggregate_array_init.rel: reorder aggregate_array_init.rel (@aggregateliteral aggregate, @expr initializer, int element_index, int position) aggregate initializer element_index

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/ProductFlow.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ module ProductFlow {
546546
Flow1::PathGraph::edges(pred1, succ1, _, _) and
547547
exists(ReturnKindExt returnKind |
548548
succ1.getNode() = returnKind.getAnOutNode(call) and
549-
pred1.getNode().(ReturnNodeExt).getKind() = returnKind
549+
paramReturnNode(_, pred1.asParameterReturnNode(), _, returnKind)
550550
)
551551
}
552552

@@ -574,7 +574,7 @@ module ProductFlow {
574574
Flow2::PathGraph::edges(pred2, succ2, _, _) and
575575
exists(ReturnKindExt returnKind |
576576
succ2.getNode() = returnKind.getAnOutNode(call) and
577-
pred2.getNode().(ReturnNodeExt).getKind() = returnKind
577+
paramReturnNode(_, pred2.asParameterReturnNode(), _, returnKind)
578578
)
579579
}
580580

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
description: Removed unused column from the `folders` and `files` relations
22
compatibility: full
3-
files.rel: reorder files.rel (int id, string name, string simple, string ext, int fromSource) id name
4-
folders.rel: reorder folders.rel (int id, string name, string simple) id name
3+
files.rel: reorder files.rel (@file id, string name, string simple, string ext, int fromSource) id name
4+
folders.rel: reorder folders.rel (@folder id, string name, string simple) id name

cpp/ql/src/Critical/NotInitialised.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ predicate undefinedLocalUse(VariableAccess va) {
5454
// it is hard to tell when a struct or array has been initialized, so we
5555
// ignore them
5656
not isAggregateType(lv.getUnderlyingType()) and
57+
not lv.isStatic() and // static variables are initialized to zero or null by default
5758
not lv.getType().hasName("va_list") and
5859
va = lv.getAnAccess() and
5960
noDefPath(lv, va) and
@@ -70,7 +71,8 @@ predicate uninitialisedGlobal(GlobalVariable gv) {
7071
va = gv.getAnAccess() and
7172
va.isRValue() and
7273
not gv.hasInitializer() and
73-
not gv.hasSpecifier("extern")
74+
not gv.hasSpecifier("extern") and
75+
not gv.isStatic() // static variables are initialized to zero or null by default
7476
)
7577
}
7678

cpp/ql/src/Likely Bugs/Format/NonConstantFormat.qhelp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ in the previous example, one solution is to make the log message a trailing argu
4242
<p>An alternative solution is to allow <code>log_with_timestamp</code> to accept format arguments:</p>
4343
<sample src="NonConstantFormat-2-good.c" />
4444
<p>In this formulation, the non-constant format string to <code>printf</code> has been replaced with
45-
a non-constant format string to <code>vprintf</code>. Semmle will no longer consider the body of
45+
a non-constant format string to <code>vprintf</code>. The analysis will no longer consider the body of
4646
<code>log_with_timestamp</code> to be a problem, and will instead check that every call to
4747
<code>log_with_timestamp</code> passes a constant format string.</p>
4848

cpp/ql/src/Likely Bugs/Memory Management/NtohlArrayNoBound.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class SnprintfSizeExpr extends BufferAccess, FunctionCall {
107107
}
108108

109109
class MemcmpSizeExpr extends BufferAccess, FunctionCall {
110-
MemcmpSizeExpr() { this.getTarget().hasName("Memcmp") }
110+
MemcmpSizeExpr() { this.getTarget().hasName("memcmp") }
111111

112112
override Expr getPointer() {
113113
result = this.getArgument(0) or
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: minorAnalysis
3+
---
4+
* The "Variable not initialized before use" query (`cpp/not-initialised`) no longer reports an alert on static variables.

cpp/ql/test/library-tests/dataflow/fields/ir-path-flow.expected

Lines changed: 120 additions & 52 deletions
Large diffs are not rendered by default.

cpp/ql/test/library-tests/dataflow/fields/path-flow.expected

Lines changed: 131 additions & 63 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)