Skip to content

Commit 48d14b7

Browse files
authored
Merge branch 'main' into rc/2.10
2 parents 3f53a36 + ee795e6 commit 48d14b7

File tree

139 files changed

+3703
-252
lines changed

Some content is hidden

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

139 files changed

+3703
-252
lines changed

.github/workflows/bump-version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
jobs:
1111

1212
apply-version-bump:
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-22.04
1414
name: Apply Version Bump
1515
steps:
1616
- name: Checkout

.github/workflows/code-scanning-pack-gen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ env:
1919
jobs:
2020
prepare-code-scanning-pack-matrix:
2121
name: Prepare CodeQL Code Scanning pack matrix
22-
runs-on: ubuntu-latest
22+
runs-on: ubuntu-22.04
2323
outputs:
2424
matrix: ${{ steps.export-code-scanning-pack-matrix.outputs.matrix }}
2525
steps:

.github/workflows/codeql_unit_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
jobs:
1515
prepare-unit-test-matrix:
1616
name: Prepare CodeQL unit test matrix
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-22.04
1818
outputs:
1919
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
2020
steps:
@@ -157,7 +157,7 @@ jobs:
157157
validate-test-results:
158158
name: Validate test results
159159
needs: [run-test-suites]
160-
runs-on: ubuntu-latest
160+
runs-on: ubuntu-22.04
161161
steps:
162162
- name: Collect test results
163163
uses: actions/download-artifact@v2

.github/workflows/create-draft-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
jobs:
2222
create-draft-release:
2323
name: Create draft release
24-
runs-on: ubuntu-latest
24+
runs-on: ubuntu-22.04
2525
env:
2626
# AWS CONFIGURATION
2727
AWS_EC2_INSTANCE_TYPE: ${{ github.event.inputs.aws_ec2_instance_type }}

.github/workflows/generate-html-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
jobs:
1616
generate-html-doc:
1717
name: Generate HTML documentation
18-
runs-on: ubuntu-latest
18+
runs-on: ubuntu-22.04
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v2

.github/workflows/standard_library_upgrade_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
jobs:
1515
prepare-unit-test-matrix:
1616
name: Prepare CodeQL unit test matrix
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-22.04
1818
outputs:
1919
matrix: ${{ steps.export-unit-test-matrix.outputs.matrix }}
2020
steps:
@@ -154,7 +154,7 @@ jobs:
154154
validate-test-results:
155155
name: Validate test results
156156
needs: [run-test-suites]
157-
runs-on: ubuntu-latest
157+
runs-on: ubuntu-22.04
158158
steps:
159159
- name: Install Python
160160
uses: actions/setup-python@v4

.github/workflows/upgrade_codeql_dependencies.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
env:
2121
CODEQL_CLI_VERSION: ${{ github.event.inputs.codeql_cli_version }}
2222
CODEQL_LIB_COMMIT: ${{ github.event.inputs.codeql_standard_library_commit }}
23-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-22.04
2424
steps:
2525
- name: Checkout
2626
uses: actions/checkout@v2

.github/workflows/validate-coding-standards.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818
jobs:
1919
validate-package-files:
2020
name: Validate Package Files
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v2
@@ -63,7 +63,7 @@ jobs:
6363
6464
validate-codeql-format:
6565
name: "Validate CodeQL Format"
66-
runs-on: ubuntu-latest
66+
runs-on: ubuntu-22.04
6767
steps:
6868
- name: Checkout
6969
uses: actions/checkout@v2
@@ -94,7 +94,7 @@ jobs:
9494
9595
validate-query-help-files:
9696
name: Validate Query Help Files
97-
runs-on: ubuntu-latest
97+
runs-on: ubuntu-22.04
9898
steps:
9999
- name: Checkout
100100
uses: actions/checkout@v2
@@ -129,7 +129,7 @@ jobs:
129129
130130
validate-cpp-test-files:
131131
name: Validate C++ Test Files
132-
runs-on: ubuntu-latest
132+
runs-on: ubuntu-22.04
133133
steps:
134134
- name: Checkout
135135
uses: actions/checkout@v2
@@ -152,7 +152,7 @@ jobs:
152152
153153
validate-c-test-files:
154154
name: Validate C Test Files
155-
runs-on: ubuntu-latest
155+
runs-on: ubuntu-22.04
156156
steps:
157157
- name: Checkout
158158
uses: actions/checkout@v2
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: ⚙️ Validate Rules CSV
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- "rc/**"
8+
- next
9+
pull_request:
10+
branches:
11+
- main
12+
- "rc/**"
13+
- next
14+
15+
16+
jobs:
17+
validate-rules-csv:
18+
name: Validate Rules CSV
19+
runs-on: ubuntu-22.04
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v2
23+
24+
- name: Check Rules
25+
shell: pwsh
26+
run: scripts/util/Get-DuplicateRules.ps1 -Language 'all' -CIMode
27+
28+

.vscode/tasks.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"type": "pickString",
186186
"options": [
187187
"Allocations",
188+
"Banned",
188189
"BannedFunctions",
189190
"BannedLibraries",
190191
"BannedSyntax",

c/cert/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
name: cert-c-coding-standards
2-
version: 2.10.0
2+
version: 2.11.0-dev
33
suites: codeql-suites
44
libraryPathDependencies: common-c-coding-standards

c/cert/src/rules/ENV30-C/DoNotModifyTheReturnValueOfCertainFunctions.ql

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,57 +13,10 @@
1313

1414
import cpp
1515
import codingstandards.c.cert
16-
import semmle.code.cpp.dataflow.DataFlow
17-
import DataFlow::PathGraph
16+
import codingstandards.cpp.rules.constlikereturnvalue.ConstLikeReturnValue
1817

19-
/*
20-
* Call to functions that return pointers to environment objects that should not be modified.
21-
*/
22-
23-
class NotModifiableCall extends FunctionCall {
24-
NotModifiableCall() {
25-
this.getTarget()
26-
.hasGlobalName(["getenv", "setlocale", "localeconv", "asctime", "strerror"])
27-
}
28-
}
29-
30-
/*
31-
* An expression that modifies an object.
32-
*/
33-
34-
class ObjectWrite extends Expr {
35-
ObjectWrite() {
36-
// the pointed object is reassigned
37-
exists(Expr e |
38-
e = [any(AssignExpr ae).getLValue(), any(CrementOperation co).getOperand()] and
39-
(
40-
this = e.(PointerDereferenceExpr).getOperand()
41-
or
42-
this = e.(PointerFieldAccess).getQualifier()
43-
)
44-
)
18+
class DoNotModifyTheReturnValueOfCertainFunctionsQuery extends ConstLikeReturnValueSharedQuery {
19+
DoNotModifyTheReturnValueOfCertainFunctionsQuery() {
20+
this = Contracts1Package::doNotModifyTheReturnValueOfCertainFunctionsQuery()
4521
}
4622
}
47-
48-
/**
49-
* DF configuration for flows from a `NotModifiableCall` to a object modifications.
50-
*/
51-
class DFConf extends DataFlow::Configuration {
52-
DFConf() { this = "DFConf" }
53-
54-
override predicate isSource(DataFlow::Node source) {
55-
source.asExpr() instanceof NotModifiableCall
56-
}
57-
58-
override predicate isSink(DataFlow::Node sink) { sink.asExpr() instanceof ObjectWrite }
59-
}
60-
61-
from DataFlow::PathNode source, DataFlow::PathNode sink
62-
where
63-
not isExcluded(sink.getNode().asExpr(),
64-
Contracts1Package::doNotModifyTheReturnValueOfCertainFunctionsQuery()) and
65-
// the modified object comes from a call to one of the ENV functions
66-
any(DFConf d).hasFlowPath(source, sink)
67-
select sink.getNode(), source, sink,
68-
"The object returned by the function " +
69-
source.getNode().asExpr().(FunctionCall).getTarget().getName() + " should no be modified."

0 commit comments

Comments
 (0)