Skip to content

Commit bc0e02d

Browse files
authored
Merge branch 'main' into mbaluda/updateql2.10.5
2 parents 0844615 + dcd22fd commit bc0e02d

File tree

67 files changed

+1098
-82
lines changed

Some content is hidden

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

67 files changed

+1098
-82
lines changed

.github/workflows/bump-version.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,5 @@ jobs:
2727
title: "Release Engineering: Version bump to ${{ github.event.inputs.new_version }}."
2828
body: "This PR updates codeql-coding-standards to version ${{ github.event.inputs.new_version }}."
2929
commit-message: "Version bump to ${{ github.event.inputs.new_version }}."
30-
team-reviewers: github/codeql-coding-standards
3130
delete-branch: true
3231
branch: "automation/version-bump-${{ github.event.inputs.new_version }}"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Code Scanning Query Pack Generation
22

33
on:
4+
merge_group:
45
pull_request:
56
branches:
67
- main

.github/workflows/codeql_unit_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: CodeQL Unit Testing
22

33
on:
4+
merge_group:
45
push:
56
branches:
67
- main

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
inputs:
66
release_version_tag:
77
description: |
8-
The tag for the new draft release, e.g. v0.5.1.
8+
The tag for the new draft release, e.g. 0.5.1 - do not include the `v`.
99
required: true
1010
codeql_analysis_threads:
1111
description: |

.github/workflows/extra-rule-validation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: ⚙️ Extra Rule Validation
22

33
on:
4+
merge_group:
45
push:
56
branches:
67
- main

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Generate HTML documentation
22

33
on:
4+
merge_group:
45
push:
56
branches:
67
- main

.github/workflows/tooling-unit-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: 🧰 Tooling unit tests
22

33
on:
4+
merge_group:
45
push:
56
branches:
67
- main

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Validating Coding Standards
22

33
on:
4+
merge_group:
45
push:
56
branches:
67
- main

.github/workflows/verify-standard-library-dependencies.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Verify Standard Library Dependencies
22

33
# Run this workflow every time the "supported_codeql_configs.json" file or a "qlpack.yml" file is changed
44
on:
5+
merge_group:
56
pull_request:
67
branches:
78
- main

c/cert/src/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-c-coding-standards
2-
version: 2.14.0-dev
2+
version: 2.15.0-dev
33
description: CERT C 2016
44
suites: codeql-suites
55
license: MIT

c/cert/test/qlpack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: codeql/cert-c-coding-standards-tests
2-
version: 2.14.0-dev
2+
version: 2.15.0-dev
33
extractor: cpp
44
license: MIT
55
dependencies:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
edges
2+
| test.c:7:13:7:14 | p1 | test.c:9:9:9:10 | p1 |
3+
| test.c:16:19:16:41 | __builtin_offsetof | test.c:18:26:18:31 | offset |
4+
| test.c:16:19:16:41 | __builtin_offsetof | test.c:29:6:29:11 | offset |
5+
| test.c:17:17:17:26 | sizeof(<expr>) | test.c:23:9:23:12 | size |
6+
| test.c:29:6:29:11 | offset | test.c:7:13:7:14 | p1 |
7+
nodes
8+
| test.c:7:13:7:14 | p1 | semmle.label | p1 |
9+
| test.c:9:9:9:10 | p1 | semmle.label | p1 |
10+
| test.c:16:19:16:41 | __builtin_offsetof | semmle.label | __builtin_offsetof |
11+
| test.c:17:17:17:26 | sizeof(<expr>) | semmle.label | sizeof(<expr>) |
12+
| test.c:18:26:18:31 | offset | semmle.label | offset |
13+
| test.c:23:9:23:12 | size | semmle.label | size |
14+
| test.c:25:9:25:18 | sizeof(<expr>) | semmle.label | sizeof(<expr>) |
15+
| test.c:27:17:27:26 | sizeof(<expr>) | semmle.label | sizeof(<expr>) |
16+
| test.c:29:6:29:11 | offset | semmle.label | offset |
17+
subpaths
18+
#select
19+
| test.c:9:9:9:10 | p1 | test.c:16:19:16:41 | __builtin_offsetof | test.c:9:9:9:10 | p1 | Scaled integer used in pointer arithmetic. |
20+
| test.c:18:26:18:31 | offset | test.c:16:19:16:41 | __builtin_offsetof | test.c:18:26:18:31 | offset | Scaled integer used in pointer arithmetic. |
21+
| test.c:23:9:23:12 | size | test.c:17:17:17:26 | sizeof(<expr>) | test.c:23:9:23:12 | size | Scaled integer used in pointer arithmetic. |
22+
| test.c:25:9:25:18 | sizeof(<expr>) | test.c:25:9:25:18 | sizeof(<expr>) | test.c:25:9:25:18 | sizeof(<expr>) | Scaled integer used in pointer arithmetic. |
23+
| test.c:27:17:27:26 | sizeof(<expr>) | test.c:27:17:27:26 | sizeof(<expr>) | test.c:27:17:27:26 | sizeof(<expr>) | Scaled integer used in pointer arithmetic. |
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
edges
2+
| test.c:7:13:7:14 | p1 | test.c:9:9:9:10 | p1 |
3+
| test.c:16:19:16:41 | __builtin_offsetof | test.c:18:26:18:31 | offset |
4+
| test.c:16:19:16:41 | __builtin_offsetof | test.c:29:6:29:11 | offset |
5+
| test.c:17:17:17:26 | sizeof(<expr>) | test.c:23:9:23:12 | size |
6+
| test.c:29:6:29:11 | offset | test.c:7:13:7:14 | p1 |
7+
nodes
8+
| test.c:7:13:7:14 | p1 | semmle.label | p1 |
9+
| test.c:9:9:9:10 | p1 | semmle.label | p1 |
10+
| test.c:16:19:16:41 | __builtin_offsetof | semmle.label | __builtin_offsetof |
11+
| test.c:17:17:17:26 | sizeof(<expr>) | semmle.label | sizeof(<expr>) |
12+
| test.c:18:26:18:31 | offset | semmle.label | offset |
13+
| test.c:23:9:23:12 | size | semmle.label | size |
14+
| test.c:25:9:25:18 | sizeof(<expr>) | semmle.label | sizeof(<expr>) |
15+
| test.c:27:17:27:26 | sizeof(<expr>) | semmle.label | sizeof(<expr>) |
16+
| test.c:29:6:29:11 | offset | semmle.label | offset |
17+
subpaths
18+
#select
19+
| test.c:9:9:9:10 | p1 | test.c:16:19:16:41 | __builtin_offsetof | test.c:9:9:9:10 | p1 | Scaled integer used in pointer arithmetic. |
20+
| test.c:18:26:18:31 | offset | test.c:16:19:16:41 | __builtin_offsetof | test.c:18:26:18:31 | offset | Scaled integer used in pointer arithmetic. |
21+
| test.c:23:9:23:12 | size | test.c:17:17:17:26 | sizeof(<expr>) | test.c:23:9:23:12 | size | Scaled integer used in pointer arithmetic. |
22+
| test.c:25:9:25:18 | sizeof(<expr>) | test.c:25:9:25:18 | sizeof(<expr>) | test.c:25:9:25:18 | sizeof(<expr>) | Scaled integer used in pointer arithmetic. |
23+
| test.c:27:17:27:26 | sizeof(<expr>) | test.c:27:17:27:26 | sizeof(<expr>) | test.c:27:17:27:26 | sizeof(<expr>) | Scaled integer used in pointer arithmetic. |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
edges
2+
| test.c:20:15:20:23 | array to pointer conversion | test.c:21:8:21:16 | (const char *)... |
3+
| test.c:20:15:20:23 | array to pointer conversion | test.c:21:8:21:16 | file_name |
4+
| test.c:20:15:20:23 | array to pointer conversion | test.c:21:8:21:16 | file_name indirection |
5+
| test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | (const char *)... |
6+
| test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | file_name |
7+
| test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | file_name indirection |
8+
| test.c:20:15:20:23 | scanf output argument | test.c:21:8:21:16 | (const char *)... |
9+
| test.c:20:15:20:23 | scanf output argument | test.c:21:8:21:16 | file_name |
10+
| test.c:20:15:20:23 | scanf output argument | test.c:21:8:21:16 | file_name indirection |
11+
| test.c:45:15:45:23 | array to pointer conversion | test.c:46:29:46:37 | (LPCTSTR)... |
12+
| test.c:45:15:45:23 | array to pointer conversion | test.c:46:29:46:37 | file_name |
13+
| test.c:45:15:45:23 | array to pointer conversion | test.c:46:29:46:37 | file_name indirection |
14+
| test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | (LPCTSTR)... |
15+
| test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | file_name |
16+
| test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | file_name indirection |
17+
| test.c:45:15:45:23 | scanf output argument | test.c:46:29:46:37 | (LPCTSTR)... |
18+
| test.c:45:15:45:23 | scanf output argument | test.c:46:29:46:37 | file_name |
19+
| test.c:45:15:45:23 | scanf output argument | test.c:46:29:46:37 | file_name indirection |
20+
subpaths
21+
nodes
22+
| test.c:20:15:20:23 | array to pointer conversion | semmle.label | array to pointer conversion |
23+
| test.c:20:15:20:23 | file_name | semmle.label | file_name |
24+
| test.c:20:15:20:23 | scanf output argument | semmle.label | scanf output argument |
25+
| test.c:21:8:21:16 | (const char *)... | semmle.label | (const char *)... |
26+
| test.c:21:8:21:16 | (const char *)... | semmle.label | (const char *)... |
27+
| test.c:21:8:21:16 | file_name | semmle.label | file_name |
28+
| test.c:21:8:21:16 | file_name indirection | semmle.label | file_name indirection |
29+
| test.c:21:8:21:16 | file_name indirection | semmle.label | file_name indirection |
30+
| test.c:45:15:45:23 | array to pointer conversion | semmle.label | array to pointer conversion |
31+
| test.c:45:15:45:23 | file_name | semmle.label | file_name |
32+
| test.c:45:15:45:23 | scanf output argument | semmle.label | scanf output argument |
33+
| test.c:46:29:46:37 | (LPCTSTR)... | semmle.label | (LPCTSTR)... |
34+
| test.c:46:29:46:37 | (LPCTSTR)... | semmle.label | (LPCTSTR)... |
35+
| test.c:46:29:46:37 | file_name | semmle.label | file_name |
36+
| test.c:46:29:46:37 | file_name indirection | semmle.label | file_name indirection |
37+
| test.c:46:29:46:37 | file_name indirection | semmle.label | file_name indirection |
38+
#select
39+
| test.c:21:8:21:16 | file_name | test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | file_name | This argument to a file access function is derived from $@ and then passed to func(file_name), which calls fopen(__filename) | test.c:20:15:20:23 | file_name | user input (scanf) |
40+
| test.c:46:29:46:37 | file_name | test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | file_name | This argument to a file access function is derived from $@ and then passed to CreateFile(lpFileName) | test.c:45:15:45:23 | file_name | user input (scanf) |
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
edges
2+
| test.c:20:15:20:23 | array to pointer conversion | test.c:21:8:21:16 | (const char *)... |
3+
| test.c:20:15:20:23 | array to pointer conversion | test.c:21:8:21:16 | file_name |
4+
| test.c:20:15:20:23 | array to pointer conversion | test.c:21:8:21:16 | file_name indirection |
5+
| test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | (const char *)... |
6+
| test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | file_name |
7+
| test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | file_name indirection |
8+
| test.c:20:15:20:23 | scanf output argument | test.c:21:8:21:16 | (const char *)... |
9+
| test.c:20:15:20:23 | scanf output argument | test.c:21:8:21:16 | file_name |
10+
| test.c:20:15:20:23 | scanf output argument | test.c:21:8:21:16 | file_name indirection |
11+
| test.c:45:15:45:23 | array to pointer conversion | test.c:46:29:46:37 | (LPCTSTR)... |
12+
| test.c:45:15:45:23 | array to pointer conversion | test.c:46:29:46:37 | file_name |
13+
| test.c:45:15:45:23 | array to pointer conversion | test.c:46:29:46:37 | file_name indirection |
14+
| test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | (LPCTSTR)... |
15+
| test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | file_name |
16+
| test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | file_name indirection |
17+
| test.c:45:15:45:23 | scanf output argument | test.c:46:29:46:37 | (LPCTSTR)... |
18+
| test.c:45:15:45:23 | scanf output argument | test.c:46:29:46:37 | file_name |
19+
| test.c:45:15:45:23 | scanf output argument | test.c:46:29:46:37 | file_name indirection |
20+
subpaths
21+
nodes
22+
| test.c:20:15:20:23 | array to pointer conversion | semmle.label | array to pointer conversion |
23+
| test.c:20:15:20:23 | file_name | semmle.label | file_name |
24+
| test.c:20:15:20:23 | scanf output argument | semmle.label | scanf output argument |
25+
| test.c:21:8:21:16 | (const char *)... | semmle.label | (const char *)... |
26+
| test.c:21:8:21:16 | (const char *)... | semmle.label | (const char *)... |
27+
| test.c:21:8:21:16 | file_name | semmle.label | file_name |
28+
| test.c:21:8:21:16 | file_name indirection | semmle.label | file_name indirection |
29+
| test.c:21:8:21:16 | file_name indirection | semmle.label | file_name indirection |
30+
| test.c:45:15:45:23 | array to pointer conversion | semmle.label | array to pointer conversion |
31+
| test.c:45:15:45:23 | file_name | semmle.label | file_name |
32+
| test.c:45:15:45:23 | scanf output argument | semmle.label | scanf output argument |
33+
| test.c:46:29:46:37 | (LPCTSTR)... | semmle.label | (LPCTSTR)... |
34+
| test.c:46:29:46:37 | (LPCTSTR)... | semmle.label | (LPCTSTR)... |
35+
| test.c:46:29:46:37 | file_name | semmle.label | file_name |
36+
| test.c:46:29:46:37 | file_name indirection | semmle.label | file_name indirection |
37+
| test.c:46:29:46:37 | file_name indirection | semmle.label | file_name indirection |
38+
#select
39+
| test.c:21:8:21:16 | file_name | test.c:20:15:20:23 | file_name | test.c:21:8:21:16 | file_name | This argument to a file access function is derived from $@ and then passed to func(file_name), which calls fopen(__filename) | test.c:20:15:20:23 | file_name | user input (scanf) |
40+
| test.c:46:29:46:37 | file_name | test.c:45:15:45:23 | file_name | test.c:46:29:46:37 | file_name | This argument to a file access function is derived from $@ and then passed to CreateFile(lpFileName) | test.c:45:15:45:23 | file_name | user input (scanf) |
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
| test.c:10:20:10:26 | * ... | A FILE object is being copied. |
2-
| test.c:17:21:17:30 | * ... | A FILE object is being copied. |
3-
| test.c:23:21:23:31 | * ... | A FILE object is being copied. |
4-
| test.c:29:15:29:21 | * ... | A FILE object is being copied. |
5-
| test.c:42:19:42:28 | * ... | A FILE object is being copied. |
1+
| test.c:11:20:11:26 | * ... | A FILE object is being copied. |
2+
| test.c:18:21:18:30 | * ... | A FILE object is being copied. |
3+
| test.c:24:21:24:31 | * ... | A FILE object is being copied. |
4+
| test.c:30:15:30:21 | * ... | A FILE object is being copied. |
5+
| test.c:43:19:43:28 | * ... | A FILE object is being copied. |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
| test.c:4:20:4:26 | * ... | A FILE object is being copied. |
2+
| test.c:11:21:11:30 | * ... | A FILE object is being copied. |
3+
| test.c:17:21:17:31 | * ... | A FILE object is being copied. |
4+
| test.c:23:15:23:21 | * ... | A FILE object is being copied. |
5+
| test.c:36:19:36:28 | * ... | A FILE object is being copied. |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
| test.c:4:20:4:26 | * ... | A FILE object is being copied. |
2+
| test.c:11:21:11:30 | * ... | A FILE object is being copied. |
3+
| test.c:17:21:17:31 | * ... | A FILE object is being copied. |
4+
| test.c:23:15:23:21 | * ... | A FILE object is being copied. |
5+
| test.c:36:19:36:28 | * ... | A FILE object is being copied. |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdio.h>
2+
// Workaround for the Musl implementing FILE as an incomplete type.
23
#if !defined(__DEFINED_struct__IO_FILE)
34
struct _IO_FILE {
45
char __x;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include <stdio.h>
2+
3+
int f1(void) {
4+
FILE my_stdout = *stdout; // NON_COMPLIANT
5+
return fputs("Hello, World!\n", &my_stdout);
6+
}
7+
8+
int f2(void) {
9+
FILE *my_stdout;
10+
my_stdout = stdout; // COMPLIANT
11+
FILE my_stdout2 = *my_stdout; // NON_COMPLIANT
12+
return fputs("Hello, World!\n", my_stdout);
13+
}
14+
int f2b(void) {
15+
FILE *const *my_stdout;
16+
my_stdout = &stdout; // COMPLIANT
17+
FILE my_stdout2 = **my_stdout; // NON_COMPLIANT
18+
return fputs("Hello, World!\n", *my_stdout);
19+
}
20+
21+
int f3(void) {
22+
FILE my_stdout;
23+
my_stdout = *stdout; // NON_COMPLIANT
24+
return fputs("Hello, World!\n", &my_stdout);
25+
}
26+
27+
int f4(void) {
28+
FILE *my_stdout;
29+
my_stdout = fopen("file.txt", "w"); // COMPLIANT
30+
return fputs("Hello, World!\n", my_stdout);
31+
}
32+
33+
int f5helper(FILE my_stdout) { return fputs("Hello, World!\n", &my_stdout); }
34+
int f5(void) {
35+
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT
36+
return f5helper(*my_stdout); // NON_COMPLIANT
37+
}
38+
39+
int f6helper(FILE *my_stdout) { return fputs("Hello, World!\n", my_stdout); }
40+
int f6(void) {
41+
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT
42+
return f6helper(my_stdout); // COMPLIANT
43+
}

c/cert/test/rules/FIO38-C/test.c.gcc

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include <stdio.h>
2+
3+
int f1(void) {
4+
FILE my_stdout = *stdout; // NON_COMPLIANT
5+
return fputs("Hello, World!\n", &my_stdout);
6+
}
7+
8+
int f2(void) {
9+
FILE *my_stdout;
10+
my_stdout = stdout; // COMPLIANT
11+
FILE my_stdout2 = *my_stdout; // NON_COMPLIANT
12+
return fputs("Hello, World!\n", my_stdout);
13+
}
14+
int f2b(void) {
15+
FILE *const *my_stdout;
16+
my_stdout = &stdout; // COMPLIANT
17+
FILE my_stdout2 = **my_stdout; // NON_COMPLIANT
18+
return fputs("Hello, World!\n", *my_stdout);
19+
}
20+
21+
int f3(void) {
22+
FILE my_stdout;
23+
my_stdout = *stdout; // NON_COMPLIANT
24+
return fputs("Hello, World!\n", &my_stdout);
25+
}
26+
27+
int f4(void) {
28+
FILE *my_stdout;
29+
my_stdout = fopen("file.txt", "w"); // COMPLIANT
30+
return fputs("Hello, World!\n", my_stdout);
31+
}
32+
33+
int f5helper(FILE my_stdout) { return fputs("Hello, World!\n", &my_stdout); }
34+
int f5(void) {
35+
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT
36+
return f5helper(*my_stdout); // NON_COMPLIANT
37+
}
38+
39+
int f6helper(FILE *my_stdout) { return fputs("Hello, World!\n", my_stdout); }
40+
int f6(void) {
41+
FILE *my_stdout = fopen("file.txt", "w"); // COMPLIANT
42+
return f6helper(my_stdout); // COMPLIANT
43+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <fcntl.h>
22
#include <stdio.h>
33
#include <stdlib.h>
4+
#include <sys/stat.h>
45
#include <unistd.h>
5-
66
int f1a(const char *filename) {
77
FILE *f = fopen(filename, "r"); // NON_COMPLIANT
88
if (NULL == f) {

0 commit comments

Comments
 (0)