Skip to content

Commit 392fba6

Browse files
committed
Merge main into rust/remove-argfile
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 68782cf6-b72d-4197-95b1-5c6003baf543 # Conflicts: # rust/extractor/src/main.rs
2 parents 08eff93 + e68cb84 commit 392fba6

152 files changed

Lines changed: 14031 additions & 8004 deletions

File tree

Some content is hidden

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

‎.bazelversion‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9.0.0
1+
9.3.1

‎MODULE.bazel‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ local_path_override(
1414

1515
# see https://registry.bazel.build/ for a list of available packages
1616

17-
bazel_dep(name = "platforms", version = "1.0.0")
18-
bazel_dep(name = "rules_cc", version = "0.2.20")
19-
bazel_dep(name = "rules_go", version = "0.60.0")
17+
bazel_dep(name = "platforms", version = "1.1.0")
18+
bazel_dep(name = "rules_cc", version = "0.2.27")
19+
bazel_dep(name = "rules_go", version = "0.65.0")
2020
bazel_dep(name = "rules_java", version = "9.6.1")
2121
bazel_dep(name = "rules_pkg", version = "1.2.0")
22-
bazel_dep(name = "rules_nodejs", version = "6.7.5")
23-
bazel_dep(name = "rules_python", version = "1.9.0")
24-
bazel_dep(name = "rules_shell", version = "0.7.1")
22+
bazel_dep(name = "rules_nodejs", version = "6.7.7")
23+
bazel_dep(name = "rules_python", version = "2.4.5")
24+
bazel_dep(name = "rules_shell", version = "0.8.0")
2525
bazel_dep(name = "bazel_skylib", version = "1.9.0")
2626
bazel_dep(name = "abseil-cpp", version = "20260107.1", repo_name = "absl")
27-
bazel_dep(name = "nlohmann_json", version = "3.12.0.bcr.1", repo_name = "json")
27+
bazel_dep(name = "nlohmann_json", version = "3.12.0.bcr.2", repo_name = "json")
2828
bazel_dep(name = "fmt", version = "12.1.0-codeql.1")
2929
bazel_dep(name = "rules_kotlin", version = "2.2.2-codeql.1")
30-
bazel_dep(name = "gazelle", version = "0.50.0")
30+
bazel_dep(name = "gazelle", version = "0.54.0")
3131
bazel_dep(name = "rules_dotnet", version = "0.21.5-codeql.1")
32-
bazel_dep(name = "googletest", version = "1.17.0.bcr.2")
32+
bazel_dep(name = "googletest", version = "1.18.0.bcr.1")
3333
bazel_dep(name = "rules_rust", version = "0.74.0")
34-
bazel_dep(name = "rules_swift", version = "4.0.0-rc5-codeql.2")
34+
bazel_dep(name = "rules_swift", version = "4.0.0-rc5-codeql.3")
3535
bazel_dep(name = "swift-syntax", version = "603.0.2")
3636
bazel_dep(name = "zstd", version = "1.5.7.bcr.1")
3737

38-
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
38+
bazel_dep(name = "buildifier_prebuilt", version = "10.1.0", dev_dependency = True)
3939

4040
# Keep edition and version approximately in sync with internal repo.
4141
# the versions there are canonical, the versions here are used for CI in github/codeql, as well as for the vendoring of dependencies.

‎cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaImplCommon.qll‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ private module IteratorIndirections {
217217
)
218218
}
219219

220+
// A by-value crement result loads the iterator, rather than aliasing its address.
221+
override predicate isAdditionalDereference(Instruction deref, Operand address) {
222+
exists(CallInstruction call |
223+
deref = call and
224+
call.getStaticCallTarget() instanceof Iterator::IteratorCrementMemberOperator and
225+
not call.getResultType() instanceof Cpp::ReferenceType and
226+
address = call.getThisArgumentOperand()
227+
)
228+
}
229+
220230
override predicate isAdditionalConversionFlow(Operand opFrom, Instruction instrTo) {
221231
// This is a bit annoying: Consider the following snippet:
222232
// ```
@@ -255,11 +265,11 @@ private module IteratorIndirections {
255265
store.getDestinationAddress() = var
256266
)
257267
or
258-
// A call to `operator++` or `operator--` is the iterator equivalent version of a
259-
// pointer arithmetic instruction.
268+
// A reference-returning `operator++` or `operator--` preserves the iterator's address.
260269
exists(CallInstruction call |
261270
instrTo = call and
262271
call.getStaticCallTarget() instanceof Iterator::IteratorCrementMemberOperator and
272+
call.getResultType() instanceof Cpp::ReferenceType and
263273
opFrom = call.getThisArgumentOperand()
264274
)
265275
}

‎cpp/ql/src/Best Practices/Unused Entities/UnusedLocals.ql‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ where
5757
not declarationHasSideEffects(v) and
5858
not exists(AsmStmt s | f = s.getEnclosingFunction()) and
5959
not v.getAnAttribute().getName() = "unused" and
60+
not v.getAnAttribute().getName() = "maybe_unused" and
6061
not f.hasErrors() // Unextracted expressions may use `v`
6162
select v, "Variable " + v.getName() + " is not used."

‎cpp/ql/src/Best Practices/Unused Entities/UnusedStaticVariables.ql‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ where
2626
not v instanceof MemberVariable and
2727
not declarationHasSideEffects(v) and
2828
not v.getAnAttribute().hasName("used") and
29-
not v.getAnAttribute().hasName("unused")
29+
not v.getAnAttribute().hasName("unused") and
30+
not v.getAnAttribute().hasName("maybe_unused")
3031
select v, "Static variable " + v.getName() + " is never read."

‎cpp/ql/src/Security/CWE/CWE-468/IncorrectPointerScaling.ql‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ where
2222
destBase = baseType(destType) and
2323
destBase.getSize() != sourceBase.getSize() and
2424
not dest.isInMacroExpansion() and
25-
// If the source type is a `char*` or `void*` then don't
25+
// If the source type is a `char*`, `void*` or `std::byte*` then don't
2626
// produce a result, because it is likely to be a false
2727
// positive.
2828
not sourceBase instanceof CharType and
2929
not sourceBase instanceof VoidType and
30+
not sourceBase.(Enum).hasQualifiedName("std", "byte") and
3031
// Low-level pointer tricks often involve casting a struct pointer to a
3132
// char pointer, then accessing it at byte offsets. For example, this can
3233
// be necessary in order to resume an interrupted `write(2)`.
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 `cpp/suspicious-pointer-scaling` query no longer reports false positives for intentional pointer arithmetic from `std::byte*` buffers.
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 `cpp/unused-local-variable` and `cpp/unused-static-variable` queries no longer report variables marked with the C++17 `[[maybe_unused]]` attribute.

‎cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedLocals/code2.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,8 @@ void test_switch_initializer()
176176
// ...
177177
}
178178
}
179+
180+
void test_maybe_unused()
181+
{
182+
[[maybe_unused]] int unused; // GOOD: explicitly marked as maybe_unused
183+
}

‎cpp/ql/test/query-tests/Best Practices/Unused Entities/UnusedStaticVariables/test.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
// semmle-extractor-options: -std=c++17
22
int globalVar; // GOOD (not static)
33
static int staticVar1; // GOOD (used)
44
static int staticVar2; // GOOD (used)
@@ -10,6 +10,7 @@ static __attribute__((__unused__)) int staticVar7; // GOOD (unused but this is e
1010
const int constVar8 = 8; // $ Alert // BAD (const defaults to static)
1111
extern const int constVar9 = 9; // GOOD
1212
static int staticVar10 = 10; // $ SPURIOUS: Alert // GOOD [FALSE POSITIVE] (referenced in a never instantiated template)
13+
[[maybe_unused]] static int staticVar11; // GOOD (explicitly marked as maybe_unused)
1314

1415
void f()
1516
{

0 commit comments

Comments
 (0)