Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8e96ef

Browse files
committed
Merge remote-tracking branch 'upstream/main' into mathiasvp/replace-ast-with-ir-use-usedataflow
2 parents d0a0025 + e7576fd commit d8e96ef

100 files changed

Lines changed: 4210 additions & 754 deletions

File tree

Some content is hidden

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

.github/workflows/compile-queries.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@ name: "Compile all queries using the latest stable CodeQL CLI"
22

33
on:
44
push:
5-
branches: [main] # makes sure the cache gets populated
6-
pull_request:
7-
branches:
5+
branches: # makes sure the cache gets populated - running on the branches people tend to merge into.
86
- main
97
- "rc/*"
8+
- "codeql-cli-*"
9+
pull_request:
1010

1111
jobs:
1212
compile-queries:
1313
runs-on: ubuntu-latest-xl
1414

1515
steps:
1616
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
1917
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
2018
- name: Calculate merge-base
2119
if: ${{ github.event_name == 'pull_request' }}
2220
env:
2321
BASE_BRANCH: ${{ github.base_ref }}
2422
run: |
25-
MERGE_BASE=$(git merge-base --fork-point origin/$BASE_BRANCH)
23+
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
2624
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
2725
- name: Read CodeQL query compilation - PR
2826
if: ${{ github.event_name == 'pull_request' }}
@@ -31,14 +29,18 @@ jobs:
3129
path: '*/ql/src/.cache'
3230
key: codeql-compile-pr-${{ github.sha }} # deliberately not using the `compile-compile-main` keys here.
3331
restore-keys: |
34-
codeql-compile-main-${{ env.merge-base }}
32+
codeql-compile-${{ github.base_ref }}-${{ env.merge-base }}
33+
codeql-compile-${{ github.base_ref }}-
3534
codeql-compile-main-
3635
- name: Fill CodeQL query compilation cache - main
3736
if: ${{ github.event_name != 'pull_request' }}
3837
uses: actions/cache@v3
3938
with:
4039
path: '*/ql/src/.cache'
41-
key: codeql-compile-main-${{ github.sha }} # just fill on main
40+
key: codeql-compile-${{ github.ref_name }}-${{ github.sha }} # just fill on main
41+
restore-keys: | # restore from another random commit, to speed up compilation.
42+
codeql-compile-${{ github.ref_name }}-
43+
codeql-compile-main-
4244
- name: Setup CodeQL
4345
uses: ./.github/actions/fetch-codeql
4446
with:

cpp/ql/test/library-tests/dataflow/taint-tests/format.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,22 @@ void test1()
5454
{
5555
char buffer[256] = {0};
5656
sink(snprintf(buffer, 256, "%s", string::source()));
57-
sink(buffer); // $ ast MISSING: ir
57+
sink(buffer); // $ ast,ir
5858
}
5959
{
6060
char buffer[256] = {0};
6161
sink(snprintf(buffer, 256, string::source(), "Hello."));
62-
sink(buffer); // $ ast MISSING: ir
62+
sink(buffer); // $ ast,ir
6363
}
6464
{
6565
char buffer[256] = {0};
6666
sink(snprintf(buffer, 256, "%s %s %s", "a", "b", string::source()));
67-
sink(buffer); // $ ast MISSING: ir
67+
sink(buffer); // $ ast,ir
6868
}
6969
{
7070
char buffer[256] = {0};
7171
sink(snprintf(buffer, 256, "%.*s", 10, string::source()));
72-
sink(buffer); // $ ast MISSING: ir
72+
sink(buffer); // $ ast,ir
7373
}
7474

7575
{
@@ -80,39 +80,39 @@ void test1()
8080
{
8181
char buffer[256] = {0};
8282
sink(snprintf(buffer, 256, "%i", source()));
83-
sink(buffer); // $ ast MISSING: ir
83+
sink(buffer); // $ ast,ir
8484
}
8585
{
8686
char buffer[256] = {0};
8787
sink(snprintf(buffer, 256, "%.*s", source(), "Hello."));
88-
sink(buffer); // $ ast MISSING: ir
88+
sink(buffer); // $ ast,ir
8989
}
9090

9191
{
9292
char buffer[256] = {0};
9393
sink(snprintf(buffer, 256, "%p", string::source()));
94-
sink(buffer); // $ ast MISSING: ir // tainted (debatable)
94+
sink(buffer); // $ ast,ir // tainted (debatable)
9595
}
9696

9797
{
9898
char buffer[256] = {0};
9999
sink(sprintf(buffer, "%s", string::source()));
100-
sink(buffer); // $ ast MISSING: ir
100+
sink(buffer); // $ ast,ir
101101
}
102102
{
103103
char buffer[256] = {0};
104104
sink(sprintf(buffer, "%ls", wstring::source()));
105-
sink(buffer); // $ ast MISSING: ir
105+
sink(buffer); // $ ast,ir
106106
}
107107
{
108108
wchar_t wbuffer[256] = {0};
109109
sink(swprintf(wbuffer, 256, L"%s", wstring::source()));
110-
sink(wbuffer); // $ ast MISSING: ir
110+
sink(wbuffer); // $ ast,ir
111111
}
112112
{
113113
char buffer[256] = {0};
114114
sink(mysprintf(buffer, 256, "%s", string::source()));
115-
sink(buffer); // $ ast MISSING: ir
115+
sink(buffer); // $ ast,ir
116116
}
117117

118118
{
@@ -133,7 +133,7 @@ void test1()
133133
{
134134
char buffer[256] = {0};
135135
sink(sscanf(string::source(), "%s", &buffer));
136-
sink(buffer); // $ ast MISSING: ir
136+
sink(buffer); // $ ast,ir
137137
}
138138
}
139139

cpp/ql/test/library-tests/dataflow/taint-tests/smart_pointer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ template<typename T> void sink(std::unique_ptr<T>&);
1010
void test_make_shared() {
1111
std::shared_ptr<int> p = std::make_shared<int>(source());
1212
sink(*p); // $ ast,ir
13-
sink(p); // $ ast MISSING: ir
13+
sink(p); // $ ast,ir
1414
}
1515

1616
void test_make_shared_array() {
@@ -22,7 +22,7 @@ void test_make_shared_array() {
2222
void test_make_unique() {
2323
std::unique_ptr<int> p = std::make_unique<int>(source());
2424
sink(*p); // $ ast,ir
25-
sink(p); // $ ast MISSING: ir
25+
sink(p); // $ ast,ir
2626
}
2727

2828
void test_make_unique_array() {

0 commit comments

Comments
 (0)