Skip to content

Commit c735297

Browse files
authored
Merge branch 'main' into automation/version-bump-2.11.0-dev
2 parents 68f5724 + b6f4bd0 commit c735297

Some content is hidden

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

45 files changed

+1732
-102
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

c/cert/src/rules/ERR30-C/ErrnoNotSetToZero.md

Lines changed: 263 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* @id c/cert/errno-not-set-to-zero
3+
* @name ERR30-C: Errno is not set to zero prior to an errno-setting call
4+
* @description Set errno to zero prior to each call to an errno-setting function. Failing to do so
5+
* might end in spurious errno values.
6+
* @kind problem
7+
* @precision high
8+
* @problem.severity error
9+
* @tags external/cert/id/err30-c
10+
* correctness
11+
* external/cert/obligation/rule
12+
*/
13+
14+
import cpp
15+
import codingstandards.c.cert
16+
import codingstandards.c.Errno
17+
18+
/**
19+
* CFG nodes preceding a `ErrnoSettingFunctionCall`
20+
*/
21+
ControlFlowNode notZeroedPriorToErrnoSet(InBandErrnoSettingFunctionCall fc) {
22+
result = fc
23+
or
24+
exists(ControlFlowNode mid |
25+
result = mid.getAPredecessor() and
26+
mid = notZeroedPriorToErrnoSet(fc) and
27+
// stop recursion when `errno` is set to zero
28+
not result instanceof ErrnoZeroed and
29+
not result = any(ErrnoGuard g).getZeroedSuccessor()
30+
)
31+
}
32+
33+
from InBandErrnoSettingFunctionCall fc, ControlFlowNode cause
34+
where
35+
not isExcluded(cause, Contracts4Package::errnoNotSetToZeroQuery()) and
36+
cause = notZeroedPriorToErrnoSet(fc) and
37+
(
38+
// `errno` is not reset anywhere in the function
39+
cause = fc.getEnclosingFunction().getBlock()
40+
or
41+
// `errno` is not reset after a call to an errno-setting function
42+
cause = any(InBandErrnoSettingFunctionCall ec | ec != fc)
43+
or
44+
// `errno` is not reset after a call to a function
45+
cause = any(FunctionCall fc2 | fc2 != fc)
46+
or
47+
// `errno` value is known to be != 0
48+
cause = any(ErrnoGuard g).getNonZeroedSuccessor()
49+
)
50+
select fc, "The value of `errno` may be different than `0` when this function is called."

0 commit comments

Comments
 (0)