Skip to content

Commit a1de784

Browse files
authored
Merge branch 'main' into knewbury01/fix-119
2 parents eff4511 + a1a5cab commit a1de784

File tree

833 files changed

+10787
-1915
lines changed

Some content is hidden

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

833 files changed

+10787
-1915
lines changed
+8-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: 🤖 Run Matrix Check
1+
name: 🤖 Run Matrix Check
22

33
on:
44
pull_request_target:
5-
types: [synchronize,opened]
5+
types: [synchronize, opened]
66
branches:
77
- "matrix/**"
88
workflow_dispatch:
@@ -11,29 +11,27 @@ jobs:
1111
dispatch-matrix-check:
1212
runs-on: ubuntu-22.04
1313
steps:
14-
1514
- name: Test Variables
1615
shell: pwsh
1716
run: |
18-
Write-Host "Running as: ${{github.actor}}"
19-
17+
Write-Host "Running as: ${{github.actor}}"
18+
2019
- name: Dispatch Matrix Testing Job
21-
if: ${{ contains(fromJSON('["jsinglet", "mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine"]'), github.actor) }}
20+
if: ${{ contains(fromJSON('["mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "nicolaswill"]'), github.actor) }}
2221
uses: peter-evans/repository-dispatch@v2
2322
with:
2423
token: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
2524
repository: github/codeql-coding-standards-release-engineering
2625
event-type: matrix-test
27-
client-payload: '{"pr": "${{ github.event.number }}"}'
28-
26+
client-payload: '{"pr": "${{ github.event.number }}"}'
2927

3028
- uses: actions/github-script@v6
31-
if: ${{ contains(fromJSON('["jsinglet", "mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine"]'), github.actor) }}
29+
if: ${{ contains(fromJSON('["mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "nicolaswill"]'), github.actor) }}
3230
with:
3331
script: |
3432
github.rest.issues.createComment({
3533
issue_number: context.issue.number,
3634
owner: context.repo.owner,
3735
repo: context.repo.repo,
3836
body: '🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results. <br><br> :bulb: If you do not hear back from me please check my status! **I will report even if this PR does not contain files eligible for matrix testing.**'
39-
})
37+
})

.github/workflows/dispatch-matrix-test-on-comment.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,23 @@ on:
88
- "rc/**"
99
- next
1010

11-
1211
jobs:
1312
dispatch-matrix-check:
1413
runs-on: ubuntu-22.04
1514
steps:
16-
1715
- name: Test Variables
1816
shell: pwsh
1917
run: |
2018
Write-Host "Running as: ${{github.actor}}"
2119
2220
$actor = "${{github.actor}}"
2321
24-
$acl = @("jsinglet","mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine")
22+
$acl = @("mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "nicolaswill")
2523
2624
if(-not ($actor -in $acl)){
2725
throw "Refusing to run workflow for user not in acl."
2826
}
2927
30-
3128
- name: Dispatch Matrix Testing Job
3229
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test-matrix') }}
3330
uses: peter-evans/repository-dispatch@v2

.github/workflows/dispatch-release-performance-check.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ jobs:
1212
dispatch-matrix-check:
1313
runs-on: ubuntu-22.04
1414
steps:
15-
1615
- name: Test Variables
1716
shell: pwsh
1817
run: |
1918
Write-Host "Running as: ${{github.actor}}"
2019
2120
$actor = "${{github.actor}}"
2221
23-
$acl = @("jsinglet","mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "kraiouchkine")
22+
$acl = @("mbaluda", "lcartey", "rvermeulen", "ravikprasad", "jeongsoolee09", "hohn", "knewbury01", "nicolaswill")
2423
2524
if(-not ($actor -in $acl)){
2625
throw "Refusing to run workflow for user not in acl."
@@ -33,8 +32,7 @@ jobs:
3332
token: ${{ secrets.RELEASE_ENGINEERING_TOKEN }}
3433
repository: github/codeql-coding-standards-release-engineering
3534
event-type: performance-test
36-
client-payload: '{"pr": "${{ github.event.issue.number }}"}'
37-
35+
client-payload: '{"pr": "${{ github.event.issue.number }}"}'
3836

3937
- uses: actions/github-script@v6
4038
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/test-performance') }}
@@ -45,4 +43,4 @@ jobs:
4543
owner: context.repo.owner,
4644
repo: context.repo.repo,
4745
body: '🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute. <br><br> :bulb: If you do not hear back from me please check my status! **I will report even if I fail!**'
48-
})
46+
})

c/cert/src/qlpack.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-c-coding-standards
2-
version: 2.32.0-dev
2+
version: 2.34.0-dev
33
description: CERT C 2016
44
suites: codeql-suites
55
license: MIT

c/cert/src/rules/INT30-C/UnsignedIntegerOperationsWrapAround.ql

+7-20
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,11 @@
1515

1616
import cpp
1717
import codingstandards.c.cert
18-
import codingstandards.cpp.Overflow
19-
import semmle.code.cpp.controlflow.Guards
20-
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
18+
import codingstandards.cpp.rules.unsignedoperationwithconstantoperandswraps.UnsignedOperationWithConstantOperandsWraps
2119

22-
from InterestingOverflowingOperation op
23-
where
24-
not isExcluded(op, IntegerOverflowPackage::unsignedIntegerOperationsWrapAroundQuery()) and
25-
op.getType().getUnderlyingType().(IntegralType).isUnsigned() and
26-
// Not within a guard condition
27-
not exists(GuardCondition gc | gc.getAChild*() = op) and
28-
// Not guarded by a check, where the check is not an invalid overflow check
29-
not op.hasValidPreCheck() and
30-
// Is not checked after the operation
31-
not op.hasValidPostCheck() and
32-
// Permitted by exception 3
33-
not op instanceof LShiftExpr and
34-
// Permitted by exception 2 - zero case is handled in separate query
35-
not op instanceof DivExpr and
36-
not op instanceof RemExpr
37-
select op,
38-
"Operation " + op.getOperator() + " of type " + op.getType().getUnderlyingType() + " may wrap."
20+
class UnsignedIntegerOperationsWrapAroundQuery extends UnsignedOperationWithConstantOperandsWrapsSharedQuery
21+
{
22+
UnsignedIntegerOperationsWrapAroundQuery() {
23+
this = IntegerOverflowPackage::unsignedIntegerOperationsWrapAroundQuery()
24+
}
25+
}

c/cert/src/rules/PRE32-C/MacroOrFunctionArgsContainHashToken.ql

+32-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,38 @@ predicate isFunctionSuccessorLocation(ControlFlowNode node, File f, int endline)
3232
PreprocessorDirective isLocatedInAFunctionInvocation(FunctionCall c) {
3333
exists(PreprocessorDirective p, File f, int startCall, int endCall |
3434
isFunctionInvocationLocation(c, f, startCall, endCall) and
35-
exists(int startLine, int endLine | isPreprocDirectiveLine(p, f, startLine, endLine) |
36-
startCall < startLine and
37-
startCall < endLine and
38-
endLine <= endCall and
39-
endLine <= endCall
35+
exists(Expr arg, int preprocStartLine, int preprocEndLine |
36+
c.getAnArgument() = arg and
37+
isPreprocDirectiveLine(p, f, preprocStartLine, preprocEndLine) and
38+
// function call begins before preprocessor directive
39+
startCall < preprocStartLine and
40+
(
41+
// argument's location is after the preprocessor directive
42+
arg.getLocation().getStartLine() > preprocStartLine
43+
or
44+
// arg's location is before an endif token that is part of a
45+
// preprocessor directive defined before the argument.
46+
// E.g.
47+
// memcpy(dest, src,
48+
// #ifdef SOMEMACRO
49+
// 12
50+
// #else
51+
// 24 // 'arg' exists here
52+
// #endif // endif after 'arg', but part of a preproc. branch before 'arg'
53+
// );
54+
p instanceof PreprocessorEndif and
55+
// exists a preprocessor branch of which this is the endif
56+
// and that preprocessor directive exists before
57+
// the argument and after the function call begins.
58+
exists(PreprocessorBranchDirective another |
59+
another.getEndIf() = p and
60+
another.getLocation().getFile() = f and
61+
startCall < another.getLocation().getStartLine() and
62+
arg.getLocation().getStartLine() > another.getLocation().getStartLine()
63+
)
64+
) and
65+
// function call ends after preprocessor directive
66+
endCall > preprocEndLine
4067
) and
4168
result = p
4269
)

c/cert/test/qlpack.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-c-coding-standards-tests
2-
version: 2.32.0-dev
2+
version: 2.34.0-dev
33
extractor: cpp
44
license: MIT
55
dependencies:

c/cert/test/rules/INT30-C/UnsignedIntegerOperationsWrapAround.expected

-4
This file was deleted.

c/cert/test/rules/INT30-C/UnsignedIntegerOperationsWrapAround.qlref

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c/common/test/rules/unsignedoperationwithconstantoperandswraps/UnsignedOperationWithConstantOperandsWraps.ql
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cpp/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.ql
1+
c/common/test/rules/donotuserandforgeneratingpseudorandomnumbers/DoNotUseRandForGeneratingPseudorandomNumbers.ql

c/cert/test/rules/PRE32-C/MacroOrFunctionArgsContainHashToken.expected

-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@
44
| test.c:20:1:20:16 | #ifdef SOMEMACRO | Invocation of function memcpy includes a token "#ifdef SOMEMACRO" that could be confused for an argument preprocessor directive. |
55
| test.c:22:1:22:5 | #else | Invocation of function memcpy includes a token "#else" that could be confused for an argument preprocessor directive. |
66
| test.c:24:1:24:6 | #endif | Invocation of function memcpy includes a token "#endif" that could be confused for an argument preprocessor directive. |
7-
| test.c:27:1:27:8 | #if TEST | Invocation of function memcpy includes a token "#if TEST" that could be confused for an argument preprocessor directive. |
8-
| test.c:28:1:28:6 | #endif | Invocation of function memcpy includes a token "#endif" that could be confused for an argument preprocessor directive. |

c/cert/test/rules/PRE32-C/test.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ void func(const char *src) {
2424
#endif // NON_COMPLIANT
2525
);
2626

27-
#if TEST // COMPLIANT[FALSE_POSITIVE]
28-
#endif // COMPLIANT[FALSE_POSITIVE]
29-
}
27+
#if TEST // COMPLIANT
28+
#endif // COMPLIANT
29+
}

c/common/src/codingstandards/c/Literals.qll

-4
This file was deleted.

c/common/src/qlpack.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/common-c-coding-standards
2-
version: 2.32.0-dev
2+
version: 2.34.0-dev
33
license: MIT
44
dependencies:
55
codeql/common-cpp-coding-standards: '*'

0 commit comments

Comments
 (0)