Skip to content

Commit 412ad17

Browse files
authored
Merge branch 'main' into aegilops/js/insecure-helmet-middleware
2 parents 5a3328b + a452ead commit 412ad17

File tree

198 files changed

+1553
-301
lines changed

Some content is hidden

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

198 files changed

+1553
-301
lines changed

.github/workflows/compile-queries.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
key: all-queries
3030
- name: check formatting
3131
run: find shared */ql -type f \( -name "*.qll" -o -name "*.ql" \) -print0 | xargs -0 -n 3000 -P 10 codeql query format -q --check-only
32+
- name: Omit DatabaseQualityDiagnostics.ql from compile checking # Remove me once CodeQL 2.18.0 is released!
33+
run: mv java/ql/src/Telemetry/DatabaseQualityDiagnostics.ql{,.hidden}
3234
- name: compile queries - check-only
3335
# run with --check-only if running in a PR (github.sha != main)
3436
if : ${{ github.event_name == 'pull_request' }}
@@ -39,3 +41,6 @@ jobs:
3941
if : ${{ github.event_name != 'pull_request' }}
4042
shell: bash
4143
run: codeql query compile -q -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" --compilation-cache-size=500
44+
- name: Restore DatabaseQualityDiagnostics.ql after compile checking # Remove me once CodeQL 2.18.0 is released
45+
run: mv java/ql/src/Telemetry/DatabaseQualityDiagnostics.ql{.hidden,}
46+

cpp/ql/lib/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## 1.2.0
2+
3+
### New Features
4+
5+
* The syntax for models-as-data rows has been extended to make it easier to select sources, sinks, and summaries that involve templated functions and classes. Additionally, the syntax has also been extended to make it easier to specify models with arbitrary levels of indirection. See `dataflow/ExternalFlow.qll` for the updated documentation and specification for the model format.
6+
* It is now possible to extend the classes `AllocationFunction` and `DeallocationFunction` via data extensions. Extensions of these classes should be added to the `lib/ext/allocation` and `lib/ext/deallocation` directories respectively.
7+
8+
### Minor Analysis Improvements
9+
10+
* The queries "Potential double free" (`cpp/double-free`) and "Potential use after free" (`cpp/use-after-free`) now produce fewer false positives.
11+
* The "Guards" library (`semmle.code.cpp.controlflow.Guards`) now also infers guards from calls to the builtin operation `__builtin_expect`. As a result, some queries may produce fewer false positives.
12+
113
## 1.1.1
214

315
No user-facing changes.

cpp/ql/lib/change-notes/2024-06-10-builtin-expect.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

cpp/ql/lib/change-notes/2024-06-13-double-free.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

cpp/ql/lib/change-notes/2024-06-20-extensible-allocation-deallocation.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

cpp/ql/lib/change-notes/2024-07-03-extended-mad-syntax.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## 1.2.0
2+
3+
### New Features
4+
5+
* The syntax for models-as-data rows has been extended to make it easier to select sources, sinks, and summaries that involve templated functions and classes. Additionally, the syntax has also been extended to make it easier to specify models with arbitrary levels of indirection. See `dataflow/ExternalFlow.qll` for the updated documentation and specification for the model format.
6+
* It is now possible to extend the classes `AllocationFunction` and `DeallocationFunction` via data extensions. Extensions of these classes should be added to the `lib/ext/allocation` and `lib/ext/deallocation` directories respectively.
7+
8+
### Minor Analysis Improvements
9+
10+
* The queries "Potential double free" (`cpp/double-free`) and "Potential use after free" (`cpp/use-after-free`) now produce fewer false positives.
11+
* The "Guards" library (`semmle.code.cpp.controlflow.Guards`) now also infers guards from calls to the builtin operation `__builtin_expect`. As a result, some queries may produce fewer false positives.

cpp/ql/lib/codeql-pack.release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
lastReleaseVersion: 1.1.1
2+
lastReleaseVersion: 1.2.0

cpp/ql/lib/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cpp-all
2-
version: 1.1.2-dev
2+
version: 1.2.1-dev
33
groups: cpp
44
dbscheme: semmlecode.cpp.dbscheme
55
extractor: cpp

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

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ predicate hasRawIndirectInstruction(Instruction instr, int indirectionIndex) {
104104

105105
cached
106106
private newtype TDefImpl =
107-
TDefAddressImpl(BaseIRVariable v) or
107+
TDefAddressImpl(BaseSourceVariable v) or
108108
TDirectDefImpl(Operand address, int indirectionIndex) {
109109
isDef(_, _, address, _, _, indirectionIndex)
110110
} or
@@ -325,9 +325,9 @@ private Instruction getInitializationTargetAddress(IRVariable v) {
325325
)
326326
}
327327

328-
/** An initial definition of an `IRVariable`'s address. */
329-
private class DefAddressImpl extends DefImpl, TDefAddressImpl {
330-
BaseIRVariable v;
328+
/** An initial definition of an SSA variable address. */
329+
abstract private class DefAddressImpl extends DefImpl, TDefAddressImpl {
330+
BaseSourceVariable v;
331331

332332
DefAddressImpl() {
333333
this = TDefAddressImpl(v) and
@@ -342,6 +342,19 @@ private class DefAddressImpl extends DefImpl, TDefAddressImpl {
342342

343343
final override Node0Impl getValue() { none() }
344344

345+
override Cpp::Location getLocation() { result = v.getLocation() }
346+
347+
final override SourceVariable getSourceVariable() {
348+
result.getBaseVariable() = v and
349+
result.getIndirection() = 0
350+
}
351+
352+
final override BaseSourceVariable getBaseSourceVariable() { result = v }
353+
}
354+
355+
private class DefVariableAddressImpl extends DefAddressImpl {
356+
override BaseIRVariable v;
357+
345358
final override predicate hasIndexInBlock(IRBlock block, int index) {
346359
exists(IRVariable var | var = v.getIRVariable() |
347360
block.getInstruction(index) = getInitializationTargetAddress(var)
@@ -353,15 +366,14 @@ private class DefAddressImpl extends DefImpl, TDefAddressImpl {
353366
index = 0
354367
)
355368
}
369+
}
356370

357-
override Cpp::Location getLocation() { result = v.getIRVariable().getLocation() }
371+
private class DefCallAddressImpl extends DefAddressImpl {
372+
override BaseCallVariable v;
358373

359-
final override SourceVariable getSourceVariable() {
360-
result.getBaseVariable() = v and
361-
result.getIndirection() = 0
374+
final override predicate hasIndexInBlock(IRBlock block, int index) {
375+
block.getInstruction(index) = v.getCallInstruction()
362376
}
363-
364-
final override BaseSourceVariable getBaseSourceVariable() { result = v }
365377
}
366378

367379
private class DirectDef extends DefImpl, TDirectDefImpl {

0 commit comments

Comments
 (0)