Skip to content

Commit d508826

Browse files
committed
Merge branch 'main' into rdmarsh2/fix-ir-globals
2 parents 07a0b4d + fceea04 commit d508826

File tree

92 files changed

+2067
-422
lines changed

Some content is hidden

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

92 files changed

+2067
-422
lines changed

.github/workflows/csv-coverage-pr-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
git log -1 --format='%H'
4242
working-directory: base
4343
- name: Set up Python 3.8
44-
uses: actions/setup-python@v3
44+
uses: actions/setup-python@v4
4545
with:
4646
python-version: 3.8
4747
- name: Download CodeQL CLI

.github/workflows/csv-coverage-pr-comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Clone self (github/codeql)
2323
uses: actions/checkout@v3
2424
- name: Set up Python 3.8
25-
uses: actions/setup-python@v3
25+
uses: actions/setup-python@v4
2626
with:
2727
python-version: 3.8
2828

.github/workflows/csv-coverage-timeseries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
path: codeqlModels
2020
fetch-depth: 0
2121
- name: Set up Python 3.8
22-
uses: actions/setup-python@v3
22+
uses: actions/setup-python@v4
2323
with:
2424
python-version: 3.8
2525
- name: Download CodeQL CLI

.github/workflows/csv-coverage-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
path: ql
2323
fetch-depth: 0
2424
- name: Set up Python 3.8
25-
uses: actions/setup-python@v3
25+
uses: actions/setup-python@v4
2626
with:
2727
python-version: 3.8
2828
- name: Download CodeQL CLI

.github/workflows/csv-coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
path: codeqlModels
2424
ref: ${{ github.event.inputs.qlModelShaOverride || github.ref }}
2525
- name: Set up Python 3.8
26-
uses: actions/setup-python@v3
26+
uses: actions/setup-python@v4
2727
with:
2828
python-version: 3.8
2929
- name: Download CodeQL CLI

.github/workflows/query-list.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
path: codeql
2525
- name: Set up Python 3.8
26-
uses: actions/setup-python@v3
26+
uses: actions/setup-python@v4
2727
with:
2828
python-version: 3.8
2929
- name: Download CodeQL CLI
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
int *global_ptr;
3+
const char *global_string = "hello, world";
4+
5+
void test1(int *ptr, int &ref)
6+
{
7+
const char *str;
8+
int v, *p;
9+
char c;
10+
11+
v = *ptr; // `ptr` dereferenced
12+
v = ptr[0]; // `ptr` dereferenced
13+
p = ptr;
14+
15+
*ptr = 0; // `ptr` dereferenced
16+
ptr[0] = 0; // `ptr` dereferenced
17+
ptr = 0;
18+
19+
(*ptr)++; // `ptr`, `*ptr` dereferenced
20+
*(ptr++); // `ptr++` dereferenced
21+
ptr++;
22+
23+
v = ref; // (`ref` implicitly dereferenced, not detected)
24+
p = &ref;
25+
ref = 0; // (`ref` implicitly dereferenced, not detected)
26+
ref++; // (`ref` implicitly dereferenced, not detected)
27+
28+
*global_ptr; // `global_ptr` dereferenced
29+
str = global_string;
30+
c = global_string[5]; // `global_string` dereferenced
31+
}
32+
33+
struct myStruct
34+
{
35+
int x;
36+
void f() {};
37+
void (*g)();
38+
};
39+
40+
void test1(myStruct *ms)
41+
{
42+
void (*h)();
43+
44+
ms;
45+
ms->x; // `ms` dereferenced
46+
ms->f(); // `ms` dereferenced
47+
ms->g(); // `ms` dereferenced
48+
h = ms->g; // `ms` dereferenced
49+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
| dereferenced.cpp:11:6:11:9 | * ... | dereferenced.cpp:11:7:11:9 | ptr |
2+
| dereferenced.cpp:12:6:12:11 | access to array | dereferenced.cpp:12:6:12:8 | ptr |
3+
| dereferenced.cpp:15:2:15:5 | * ... | dereferenced.cpp:15:3:15:5 | ptr |
4+
| dereferenced.cpp:16:2:16:7 | access to array | dereferenced.cpp:16:2:16:4 | ptr |
5+
| dereferenced.cpp:19:3:19:6 | * ... | dereferenced.cpp:19:4:19:6 | ptr |
6+
| dereferenced.cpp:19:4:19:6 | ptr | dereferenced.cpp:19:3:19:6 | * ... |
7+
| dereferenced.cpp:20:2:20:9 | * ... | dereferenced.cpp:20:4:20:8 | ... ++ |
8+
| dereferenced.cpp:28:2:28:12 | * ... | dereferenced.cpp:28:3:28:12 | global_ptr |
9+
| dereferenced.cpp:30:6:30:21 | access to array | dereferenced.cpp:30:6:30:18 | global_string |
10+
| dereferenced.cpp:45:6:45:6 | x | dereferenced.cpp:45:2:45:3 | ms |
11+
| dereferenced.cpp:46:6:46:6 | call to f | dereferenced.cpp:46:2:46:3 | ms |
12+
| dereferenced.cpp:47:6:47:6 | g | dereferenced.cpp:47:2:47:3 | ms |
13+
| dereferenced.cpp:48:10:48:10 | g | dereferenced.cpp:48:6:48:7 | ms |
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import cpp
2+
import semmle.code.cpp.controlflow.Dereferenced
3+
4+
from Expr op, Expr e
5+
where dereferencedByOperation(op, e) // => dereferenced(e)
6+
select op, e

javascript/ql/lib/semmle/javascript/internal/ConceptsImports.qll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
*/
55

66
import semmle.javascript.dataflow.DataFlow::DataFlow as DataFlow
7+
import semmle.javascript.security.CryptoAlgorithms as CryptoAlgorithms

0 commit comments

Comments
 (0)