mirror of
https://github.com/github/codeql.git
synced 2026-07-07 12:35:33 +02:00
Compare commits
474 Commits
codeql-cli
...
mbg/fix/lo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2584c99954 | ||
|
|
24b7d8bb48 | ||
|
|
03079ffd76 | ||
|
|
02710a7e11 | ||
|
|
7802f57628 | ||
|
|
c93e7db831 | ||
|
|
65beb08d5f | ||
|
|
af6ba6e9c7 | ||
|
|
425a4eb7df | ||
|
|
b2c07a4d4e | ||
|
|
a7abebf76f | ||
|
|
7671c4a539 | ||
|
|
ec41ea8382 | ||
|
|
3a4623b437 | ||
|
|
e0ccb9306a | ||
|
|
8910ba4f32 | ||
|
|
c8e894b854 | ||
|
|
1a64393c4c | ||
|
|
2c4c2dfeb3 | ||
|
|
8e3e6505ad | ||
|
|
571942fb21 | ||
|
|
6cd52237c3 | ||
|
|
5a82012d03 | ||
|
|
ee19c3d80f | ||
|
|
06767c6760 | ||
|
|
ea06ad1933 | ||
|
|
4c018759c8 | ||
|
|
62533501fe | ||
|
|
54b3262d9c | ||
|
|
babdee36aa | ||
|
|
d628cc5ab8 | ||
|
|
6b43ff45a4 | ||
|
|
d9bd41b8b1 | ||
|
|
10f0975812 | ||
|
|
9e5db7c6ec | ||
|
|
5f57a097ab | ||
|
|
951f6362aa | ||
|
|
a0b1c2ea79 | ||
|
|
2b0a5fd5d1 | ||
|
|
2e4f4c64fe | ||
|
|
0a792f2f61 | ||
|
|
0d32f00020 | ||
|
|
d6e0ef9ff9 | ||
|
|
f6e26211f9 | ||
|
|
8906e101cb | ||
|
|
5a4fe71529 | ||
|
|
50b9f5bba0 | ||
|
|
77a9cea737 | ||
|
|
67bd8cba32 | ||
|
|
29425982a5 | ||
|
|
6106edd5e2 | ||
|
|
b22da25e05 | ||
|
|
48825442c3 | ||
|
|
cdc99b5240 | ||
|
|
e3502e2e5f | ||
|
|
63b4e5ef5c | ||
|
|
51bd1ef1e1 | ||
|
|
660e6d7085 | ||
|
|
dcc1c3d487 | ||
|
|
bd5619147d | ||
|
|
713599963b | ||
|
|
9e153cfb0d | ||
|
|
587adea809 | ||
|
|
2c1ecb507d | ||
|
|
1de65131fe | ||
|
|
0685732e3f | ||
|
|
1d62751e15 | ||
|
|
0017461e2d | ||
|
|
8981d4c06b | ||
|
|
2f602a629f | ||
|
|
8ccc384043 | ||
|
|
59a8b21851 | ||
|
|
3552a41552 | ||
|
|
dc50b6bad3 | ||
|
|
8c2931cbb8 | ||
|
|
d072ed969e | ||
|
|
874fe2b8f9 | ||
|
|
fdb3b65bce | ||
|
|
7f880a24df | ||
|
|
738412260f | ||
|
|
cf7189bb28 | ||
|
|
1a416884d4 | ||
|
|
316117f5c9 | ||
|
|
2f09f0e2c1 | ||
|
|
13ae15b867 | ||
|
|
fb6725ddaa | ||
|
|
2dbacbc302 | ||
|
|
c5038ed281 | ||
|
|
6e6f2115c0 | ||
|
|
2d46272295 | ||
|
|
b36be009d4 | ||
|
|
71af8ab022 | ||
|
|
2283eacc0b | ||
|
|
59072f9e81 | ||
|
|
dd8bead21a | ||
|
|
cf9998b932 | ||
|
|
600412db48 | ||
|
|
3b15f2359b | ||
|
|
a43f3cf95f | ||
|
|
f040ff2d8d | ||
|
|
c3a1d088ac | ||
|
|
a39b2aaaac | ||
|
|
ffb267937a | ||
|
|
af8cb65b2e | ||
|
|
fd80974210 | ||
|
|
c1c0ff4308 | ||
|
|
1384aa669b | ||
|
|
5e89119b3d | ||
|
|
529be7ef18 | ||
|
|
5c466f3319 | ||
|
|
49a87e152a | ||
|
|
30738103f0 | ||
|
|
148dc6de5a | ||
|
|
f48eda829f | ||
|
|
d92b226041 | ||
|
|
5bb8f8ed5c | ||
|
|
f74c7c28ae | ||
|
|
0f032c5be9 | ||
|
|
2568318460 | ||
|
|
d06a877709 | ||
|
|
9eb7933778 | ||
|
|
99b7bc3b73 | ||
|
|
14c92e6eb3 | ||
|
|
902b0a60d0 | ||
|
|
36980bbf42 | ||
|
|
a9f1c95513 | ||
|
|
8aa2c23ba8 | ||
|
|
09d8a50494 | ||
|
|
aefb43324b | ||
|
|
8f9ad1f5ba | ||
|
|
7f31c9c7e5 | ||
|
|
e0444449c8 | ||
|
|
e29e077a03 | ||
|
|
7ae27bcc34 | ||
|
|
15ead6d0e6 | ||
|
|
70f1015fba | ||
|
|
9ebe59d353 | ||
|
|
3d1b2fdbda | ||
|
|
418d593a97 | ||
|
|
d0eb167d47 | ||
|
|
48d0eccbf6 | ||
|
|
3749a1bd4d | ||
|
|
218f553fef | ||
|
|
ebb3485a73 | ||
|
|
5fd687d3df | ||
|
|
0f993a0d26 | ||
|
|
1ae52b6c7e | ||
|
|
4f5f0aad45 | ||
|
|
18a815ca8b | ||
|
|
006eaf3e2a | ||
|
|
fd593fd4f0 | ||
|
|
ce74c9d959 | ||
|
|
6bb865ad05 | ||
|
|
1d4b2fd0bb | ||
|
|
4e1f772f23 | ||
|
|
0c7ffb0554 | ||
|
|
c3116b3f0f | ||
|
|
2a99af0e6d | ||
|
|
99ee6c95a1 | ||
|
|
ac064ac2a7 | ||
|
|
7e4f7a0c17 | ||
|
|
67cbe38255 | ||
|
|
8112058a0a | ||
|
|
372ecf402f | ||
|
|
80a4197604 | ||
|
|
c01361a1fd | ||
|
|
59a9e255c7 | ||
|
|
6622eda04c | ||
|
|
6a047d6916 | ||
|
|
ea173f9516 | ||
|
|
7422029e49 | ||
|
|
4b47b08ed2 | ||
|
|
c6d9e1ec81 | ||
|
|
c115a9fee4 | ||
|
|
5d54482c71 | ||
|
|
11ca3f49f6 | ||
|
|
787b4743ee | ||
|
|
178fd0e9e1 | ||
|
|
6914e9a17a | ||
|
|
466f24663e | ||
|
|
3fa6a7cbff | ||
|
|
a4f813183e | ||
|
|
74a58f64aa | ||
|
|
ed2dd87bda | ||
|
|
ecf568629b | ||
|
|
181a711f04 | ||
|
|
76e121e359 | ||
|
|
dc88bdccc7 | ||
|
|
ce06df3152 | ||
|
|
4c1c12dd70 | ||
|
|
1d7881e03f | ||
|
|
b7364f5428 | ||
|
|
3fa11c21c3 | ||
|
|
0ad585cfe6 | ||
|
|
54c780bdf9 | ||
|
|
ae8c75ac97 | ||
|
|
72a11e737d | ||
|
|
3367da82c4 | ||
|
|
b7eb521fa0 | ||
|
|
c71ea80029 | ||
|
|
20b35e5d02 | ||
|
|
c4119761cc | ||
|
|
89b3363761 | ||
|
|
b51c3aae85 | ||
|
|
6fbda1a9f0 | ||
|
|
f7d8d16ed3 | ||
|
|
62b69bbd3e | ||
|
|
6623e5fbf3 | ||
|
|
ce8836fb65 | ||
|
|
43696f5e27 | ||
|
|
23a847b1cf | ||
|
|
9f8d10de11 | ||
|
|
2fb5621527 | ||
|
|
943763a026 | ||
|
|
28d79eeb77 | ||
|
|
1a4048d238 | ||
|
|
5c388c554c | ||
|
|
e02b67af63 | ||
|
|
50cd40ed20 | ||
|
|
7ef8099a8b | ||
|
|
c9d1cd97fb | ||
|
|
f6c3f77602 | ||
|
|
d87c8c75d6 | ||
|
|
3b6dae41cd | ||
|
|
32471d326e | ||
|
|
7a92970d89 | ||
|
|
2ca0df0369 | ||
|
|
3fcc99e5cb | ||
|
|
f2658a0936 | ||
|
|
da90ae0e8f | ||
|
|
8d46642de3 | ||
|
|
2fc6484162 | ||
|
|
1bab950023 | ||
|
|
282ca1094e | ||
|
|
e215c4c94c | ||
|
|
16cd148961 | ||
|
|
1729319ebe | ||
|
|
18a0abdb4c | ||
|
|
293a203756 | ||
|
|
2edbfbf8bc | ||
|
|
7f5344e025 | ||
|
|
8e0a018673 | ||
|
|
49a41c98ee | ||
|
|
160d89fb4e | ||
|
|
33029b0ed8 | ||
|
|
7e0869965c | ||
|
|
c1f19dd145 | ||
|
|
b203a9eb6e | ||
|
|
aad56097ac | ||
|
|
c142495a8b | ||
|
|
5fe62e293a | ||
|
|
9f100ef2c6 | ||
|
|
eb78661c1f | ||
|
|
90f9e3f825 | ||
|
|
be06469a19 | ||
|
|
909b1d70d9 | ||
|
|
c723df3ca7 | ||
|
|
785c21f462 | ||
|
|
f626d4794a | ||
|
|
972b4629c8 | ||
|
|
64668883a4 | ||
|
|
2ec73c50f9 | ||
|
|
664fdc3b2a | ||
|
|
5157d4df7b | ||
|
|
e9bbb5d7fa | ||
|
|
c01ce955ba | ||
|
|
2e26fb1171 | ||
|
|
efe23c1da7 | ||
|
|
994a46289f | ||
|
|
ef27f9fe96 | ||
|
|
45c732a6f9 | ||
|
|
381301e552 | ||
|
|
9333e80def | ||
|
|
06ea249997 | ||
|
|
6bb09ef289 | ||
|
|
9be9636816 | ||
|
|
5b117084db | ||
|
|
82d9edfabf | ||
|
|
a3c7b2c3a2 | ||
|
|
a743fbcc95 | ||
|
|
d7bf2d9375 | ||
|
|
a9867a266e | ||
|
|
d68cfc7d4f | ||
|
|
831255e9c0 | ||
|
|
c1bc097355 | ||
|
|
cdb34bb1f9 | ||
|
|
b9b0c8091f | ||
|
|
f3914ffe25 | ||
|
|
f5e5f6dfd1 | ||
|
|
03bd6cb414 | ||
|
|
4c5f149afd | ||
|
|
1ef1d63c11 | ||
|
|
9af9b32722 | ||
|
|
bb451f3911 | ||
|
|
cdb8f67601 | ||
|
|
8d9e94a00f | ||
|
|
0a1769657d | ||
|
|
19d2b49562 | ||
|
|
1a27441cfb | ||
|
|
0e6028a7f3 | ||
|
|
d42bb119fe | ||
|
|
ad95225272 | ||
|
|
f98ff65b11 | ||
|
|
d9176541c6 | ||
|
|
44213f0144 | ||
|
|
4e6baf83c8 | ||
|
|
0beca9d96c | ||
|
|
f370cd840c | ||
|
|
b3e82498fa | ||
|
|
f03f687d61 | ||
|
|
bb26c31f84 | ||
|
|
0640bd9d8b | ||
|
|
8afb541718 | ||
|
|
a74062cd51 | ||
|
|
3b31da8a62 | ||
|
|
46baf9d5e5 | ||
|
|
c160e0b2a4 | ||
|
|
823c767aac | ||
|
|
52297c0b23 | ||
|
|
c8f35ea1ea | ||
|
|
2023abdc60 | ||
|
|
a9aa67177b | ||
|
|
10ca2dac19 | ||
|
|
14283f01ac | ||
|
|
c3b3c05cf3 | ||
|
|
2e46919e10 | ||
|
|
e45750a8ca | ||
|
|
799e0c1bcc | ||
|
|
65fe9abcfe | ||
|
|
9ad572fa29 | ||
|
|
4d228bcddf | ||
|
|
9944252c43 | ||
|
|
698a679c78 | ||
|
|
0fbb6bf608 | ||
|
|
abe501c1af | ||
|
|
5d92792e40 | ||
|
|
feaae16f7c | ||
|
|
0be8648a9d | ||
|
|
28f555c2b2 | ||
|
|
ab7ca1d642 | ||
|
|
f9b8200009 | ||
|
|
69fd5e93bc | ||
|
|
81df89f93e | ||
|
|
28ad9d00fb | ||
|
|
29221ae426 | ||
|
|
21a018e5c5 | ||
|
|
fc646a6d48 | ||
|
|
e05bb7fcee | ||
|
|
17cd182d72 | ||
|
|
9d608a78a3 | ||
|
|
bfe5a0c438 | ||
|
|
3811eae679 | ||
|
|
3815a5a096 | ||
|
|
35de551f6b | ||
|
|
515fa21aad | ||
|
|
df1a4d2ed1 | ||
|
|
68392aa8d8 | ||
|
|
02f70f3536 | ||
|
|
1d345c6101 | ||
|
|
9ef319f659 | ||
|
|
5265cb4b03 | ||
|
|
973f649e76 | ||
|
|
0e15dd9fa9 | ||
|
|
778749184b | ||
|
|
da25c586e6 | ||
|
|
8a763015e6 | ||
|
|
7cc53126f3 | ||
|
|
a023726c03 | ||
|
|
e4e13d38b7 | ||
|
|
e259ef5d1d | ||
|
|
a6571a05ab | ||
|
|
d3812f5906 | ||
|
|
07d99bd643 | ||
|
|
4215a89bc8 | ||
|
|
ac39aeb6b6 | ||
|
|
939279af38 | ||
|
|
673d37cc3d | ||
|
|
a81c54b58c | ||
|
|
e6331dc2e6 | ||
|
|
997219a280 | ||
|
|
6007827dd3 | ||
|
|
36ca97e4f6 | ||
|
|
b3dd50bc36 | ||
|
|
08e9d3391f | ||
|
|
b0d7998342 | ||
|
|
f28eb6bf31 | ||
|
|
0d6c643d77 | ||
|
|
4667068017 | ||
|
|
a9b232bff4 | ||
|
|
d97e185994 | ||
|
|
e8d3802ee5 | ||
|
|
b767dcfd18 | ||
|
|
de5965525f | ||
|
|
c251da799f | ||
|
|
16de30e07e | ||
|
|
1db829e55c | ||
|
|
573de92441 | ||
|
|
a8c55ee4b7 | ||
|
|
db0d24fdd1 | ||
|
|
cfe075ef54 | ||
|
|
8e20aeb314 | ||
|
|
b9ce588076 | ||
|
|
1544f49f91 | ||
|
|
ed534b06d5 | ||
|
|
99ddd484be | ||
|
|
7d0018c897 | ||
|
|
ac0c42c5c6 | ||
|
|
227e099854 | ||
|
|
aa1d49cb95 | ||
|
|
454af0d721 | ||
|
|
a1161c6efe | ||
|
|
725861626c | ||
|
|
30aa9b230c | ||
|
|
d1d4163b79 | ||
|
|
b7c33734b1 | ||
|
|
1e5426fca2 | ||
|
|
640f894b00 | ||
|
|
46ea067449 | ||
|
|
1f7d96a74a | ||
|
|
2034b00772 | ||
|
|
0f038ee93a | ||
|
|
7f505d8715 | ||
|
|
208388e04d | ||
|
|
6837af97bc | ||
|
|
11c03fb8c9 | ||
|
|
3084eda28a | ||
|
|
e42ae09e1c | ||
|
|
5fd5ebc26e | ||
|
|
793de3196b | ||
|
|
14fd89d482 | ||
|
|
45c0c7fe6c | ||
|
|
b35a1d4206 | ||
|
|
4ec401a3f6 | ||
|
|
d95a4a7baf | ||
|
|
ccf520a5cd | ||
|
|
85b3092b16 | ||
|
|
d72d096c86 | ||
|
|
250ac686a2 | ||
|
|
a93e361aca | ||
|
|
7162692656 | ||
|
|
4a41bb4061 | ||
|
|
26ae8f177b | ||
|
|
d35c5e90ee | ||
|
|
bf1b32f210 | ||
|
|
944adfe727 | ||
|
|
219ed64b74 | ||
|
|
24ce1c27bc | ||
|
|
07ea006cee | ||
|
|
dba344451f | ||
|
|
cf3345ee8f | ||
|
|
85a0a42da9 | ||
|
|
f7ebd1312e | ||
|
|
157a7829ca | ||
|
|
ad05cc3cb1 | ||
|
|
43596869e7 | ||
|
|
87fa159384 | ||
|
|
58e9a0436e | ||
|
|
2b61f26a64 | ||
|
|
32c4728f83 | ||
|
|
a2210959b5 | ||
|
|
fd7442868f | ||
|
|
f75b853ae4 | ||
|
|
53f24a5281 | ||
|
|
0817238177 | ||
|
|
378cc1aed2 | ||
|
|
80c92dc3e6 | ||
|
|
3461404bbb | ||
|
|
0f2a48f461 | ||
|
|
2033dd2dcc | ||
|
|
e7c6571f52 | ||
|
|
f1668801d3 | ||
|
|
5f6cb1684b | ||
|
|
0a7cfad048 | ||
|
|
f486c44b00 |
32
.github/actions/os-version/action.yml
vendored
Normal file
32
.github/actions/os-version/action.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
name: OS Version
|
||||||
|
description: Get OS version.
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
version:
|
||||||
|
description: "OS version"
|
||||||
|
value: ${{ steps.version.outputs.version }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- if: runner.os == 'Linux'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
. /etc/os-release
|
||||||
|
echo "VERSION=${NAME} ${VERSION}" >> $GITHUB_ENV
|
||||||
|
- if: runner.os == 'Windows'
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$objects = systeminfo.exe /FO CSV | ConvertFrom-Csv
|
||||||
|
"VERSION=$($objects.'OS Name') $($objects.'OS Version')" >> $env:GITHUB_ENV
|
||||||
|
- if: runner.os == 'macOS'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "VERSION=$(sw_vers -productName) $(sw_vers -productVersion)" >> $GITHUB_ENV
|
||||||
|
- name: Emit OS version
|
||||||
|
id: version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "$VERSION"
|
||||||
|
echo "version=${VERSION}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
6
.github/workflows/check-change-note.yml
vendored
6
.github/workflows/check-change-note.yml
vendored
@@ -26,3 +26,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
|
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq 'any(.[].filename ; test("/change-notes/.*[.]md$"))' |
|
||||||
grep true -c
|
grep true -c
|
||||||
|
- name: Fail if the change note filename doesn't match the expected format. The file name must be of the form 'YYYY-MM-DD.md' or 'YYYY-MM-DD-{title}.md', where '{title}' is arbitrary text.
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh api 'repos/${{github.repository}}/pulls/${{github.event.number}}/files' --paginate --jq '[.[].filename | select(test("/change-notes/.*[.]md$"))] | all(test("/change-notes/[0-9]{4}-[0-9]{2}-[0-9]{2}.*[.]md$"))' |
|
||||||
|
grep true -c
|
||||||
|
|||||||
10
.github/workflows/mad_modelDiff.yml
vendored
10
.github/workflows/mad_modelDiff.yml
vendored
@@ -11,7 +11,7 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
paths:
|
paths:
|
||||||
- "java/ql/src/utils/model-generator/**/*.*"
|
- "java/ql/src/utils/modelgenerator/**/*.*"
|
||||||
- ".github/workflows/mad_modelDiff.yml"
|
- ".github/workflows/mad_modelDiff.yml"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -40,12 +40,12 @@ jobs:
|
|||||||
- name: Download database
|
- name: Download database
|
||||||
env:
|
env:
|
||||||
SLUG: ${{ matrix.slug }}
|
SLUG: ${{ matrix.slug }}
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
set -x
|
set -x
|
||||||
mkdir lib-dbs
|
mkdir lib-dbs
|
||||||
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
|
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
|
||||||
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG} | jq .id`
|
gh api -H "Accept: application/zip" "/repos/${SLUG}/code-scanning/codeql/databases/java" > "$SHORTNAME.zip"
|
||||||
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o "$SHORTNAME.zip"
|
|
||||||
unzip -q -d "${SHORTNAME}-db" "${SHORTNAME}.zip"
|
unzip -q -d "${SHORTNAME}-db" "${SHORTNAME}.zip"
|
||||||
mkdir "lib-dbs/$SHORTNAME/"
|
mkdir "lib-dbs/$SHORTNAME/"
|
||||||
mv "${SHORTNAME}-db/"$(ls -1 "${SHORTNAME}"-db)/* "lib-dbs/${SHORTNAME}/"
|
mv "${SHORTNAME}-db/"$(ls -1 "${SHORTNAME}"-db)/* "lib-dbs/${SHORTNAME}/"
|
||||||
@@ -61,7 +61,7 @@ jobs:
|
|||||||
DATABASE=$2
|
DATABASE=$2
|
||||||
cd codeql-$QL_VARIANT
|
cd codeql-$QL_VARIANT
|
||||||
SHORTNAME=`basename $DATABASE`
|
SHORTNAME=`basename $DATABASE`
|
||||||
python java/ql/src/utils/model-generator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE ${SHORTNAME}.temp.model.yml
|
python java/ql/src/utils/modelgenerator/GenerateFlowModel.py --with-summaries --with-sinks $DATABASE ${SHORTNAME}.temp.model.yml
|
||||||
mv java/ql/lib/ext/generated/${SHORTNAME}.temp.model.yml $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.model.yml
|
mv java/ql/lib/ext/generated/${SHORTNAME}.temp.model.yml $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.model.yml
|
||||||
cd ..
|
cd ..
|
||||||
}
|
}
|
||||||
@@ -100,4 +100,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: diffs
|
name: diffs
|
||||||
path: tmp-models/*.html
|
path: tmp-models/*.html
|
||||||
|
# An html file is only produced if the generated models differ.
|
||||||
|
if-no-files-found: ignore
|
||||||
retention-days: 20
|
retention-days: 20
|
||||||
|
|||||||
2
.github/workflows/mad_regenerate-models.yml
vendored
2
.github/workflows/mad_regenerate-models.yml
vendored
@@ -50,7 +50,7 @@ jobs:
|
|||||||
SLUG: ${{ matrix.slug }}
|
SLUG: ${{ matrix.slug }}
|
||||||
run: |
|
run: |
|
||||||
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
|
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
|
||||||
java/ql/src/utils/model-generator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
|
java/ql/src/utils/modelgenerator/RegenerateModels.py "${SLUG}" dbs/${SHORTNAME}
|
||||||
- name: Stage changes
|
- name: Stage changes
|
||||||
run: |
|
run: |
|
||||||
find java -name "*.model.yml" -print0 | xargs -0 git add
|
find java -name "*.model.yml" -print0 | xargs -0 git add
|
||||||
|
|||||||
18
.github/workflows/ql-for-ql-build.yml
vendored
18
.github/workflows/ql-for-ql-build.yml
vendored
@@ -27,7 +27,7 @@ jobs:
|
|||||||
uses: ./.github/actions/find-latest-bundle
|
uses: ./.github/actions/find-latest-bundle
|
||||||
- name: Find codeql
|
- name: Find codeql
|
||||||
id: find-codeql
|
id: find-codeql
|
||||||
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
|
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
|
||||||
with:
|
with:
|
||||||
languages: javascript # does not matter
|
languages: javascript # does not matter
|
||||||
tools: ${{ steps.find-latest-bundle.outputs.url }}
|
tools: ${{ steps.find-latest-bundle.outputs.url }}
|
||||||
@@ -38,12 +38,14 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
|
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
|
||||||
|
- uses: ./.github/actions/os-version
|
||||||
|
id: os_version
|
||||||
- name: Cache entire pack
|
- name: Cache entire pack
|
||||||
id: cache-pack
|
id: cache-pack
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ runner.temp }}/pack
|
path: ${{ runner.temp }}/pack
|
||||||
key: ${{ runner.os }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
|
||||||
- name: Cache queries
|
- name: Cache queries
|
||||||
if: steps.cache-pack.outputs.cache-hit != 'true'
|
if: steps.cache-pack.outputs.cache-hit != 'true'
|
||||||
id: cache-queries
|
id: cache-queries
|
||||||
@@ -77,7 +79,7 @@ jobs:
|
|||||||
ql/target/release/ql-autobuilder.exe
|
ql/target/release/ql-autobuilder.exe
|
||||||
ql/target/release/ql-extractor
|
ql/target/release/ql-extractor
|
||||||
ql/target/release/ql-extractor.exe
|
ql/target/release/ql-extractor.exe
|
||||||
key: ${{ runner.os }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
|
||||||
- name: Cache cargo
|
- name: Cache cargo
|
||||||
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
|
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
@@ -86,7 +88,7 @@ jobs:
|
|||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
ql/target
|
ql/target
|
||||||
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
|
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
|
||||||
run: cd ql; cargo fmt --all -- --check
|
run: cd ql; cargo fmt --all -- --check
|
||||||
@@ -137,20 +139,20 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CONF: ./ql-for-ql-config.yml
|
CONF: ./ql-for-ql-config.yml
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
|
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
|
||||||
with:
|
with:
|
||||||
languages: ql
|
languages: ql
|
||||||
db-location: ${{ runner.temp }}/db
|
db-location: ${{ runner.temp }}/db
|
||||||
config-file: ./ql-for-ql-config.yml
|
config-file: ./ql-for-ql-config.yml
|
||||||
tools: ${{ steps.find-latest-bundle.outputs.url }}
|
tools: ${{ steps.find-latest-bundle.outputs.url }}
|
||||||
- name: Move pack cache
|
- name: Move pack queries
|
||||||
run: |
|
run: |
|
||||||
cp -r ${PACK}/.cache ql/ql/src/.cache
|
cp -r ${PACK}/queries ql/ql/src
|
||||||
env:
|
env:
|
||||||
PACK: ${{ runner.temp }}/pack
|
PACK: ${{ runner.temp }}/pack
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
|
uses: github/codeql-action/analyze@45955cb1830b640e2c1603ad72ad542a49d47b96
|
||||||
with:
|
with:
|
||||||
category: "ql-for-ql"
|
category: "ql-for-ql"
|
||||||
- name: Copy sarif file to CWD
|
- name: Copy sarif file to CWD
|
||||||
|
|||||||
@@ -25,16 +25,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Find codeql
|
- name: Find codeql
|
||||||
id: find-codeql
|
id: find-codeql
|
||||||
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
|
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
|
||||||
with:
|
with:
|
||||||
languages: javascript # does not matter
|
languages: javascript # does not matter
|
||||||
|
- uses: ./.github/actions/os-version
|
||||||
|
id: os_version
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
ql/target
|
ql/target
|
||||||
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
|
||||||
- name: Build Extractor
|
- name: Build Extractor
|
||||||
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./scripts/create-extractor-pack.sh
|
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./scripts/create-extractor-pack.sh
|
||||||
env:
|
env:
|
||||||
|
|||||||
66
.github/workflows/ql-for-ql-tests.yml
vendored
66
.github/workflows/ql-for-ql-tests.yml
vendored
@@ -22,28 +22,84 @@ jobs:
|
|||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Find codeql
|
- name: Find codeql
|
||||||
id: find-codeql
|
id: find-codeql
|
||||||
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
|
uses: github/codeql-action/init@45955cb1830b640e2c1603ad72ad542a49d47b96
|
||||||
with:
|
with:
|
||||||
languages: javascript # does not matter
|
languages: javascript # does not matter
|
||||||
|
- uses: ./.github/actions/os-version
|
||||||
|
id: os_version
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
ql/target
|
ql/target
|
||||||
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
|
||||||
- name: Build extractor
|
- name: Build extractor
|
||||||
run: |
|
run: |
|
||||||
cd ql;
|
cd ql;
|
||||||
codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
|
codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
|
||||||
env "PATH=$PATH:$codeqlpath" ./scripts/create-extractor-pack.sh
|
env "PATH=$PATH:$codeqlpath" ./scripts/create-extractor-pack.sh
|
||||||
|
- name: Cache compilation cache
|
||||||
|
id: query-cache
|
||||||
|
uses: ./.github/actions/cache-query-compilation
|
||||||
|
with:
|
||||||
|
key: ql-for-ql-tests
|
||||||
- name: Run QL tests
|
- name: Run QL tests
|
||||||
run: |
|
run: |
|
||||||
"${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries ql/ql/test
|
"${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}" ql/ql/test
|
||||||
env:
|
env:
|
||||||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
|
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
|
||||||
- name: Check QL formatting
|
|
||||||
|
other-os:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest]
|
||||||
|
needs: [qltest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Install GNU tar
|
||||||
|
if: runner.os == 'macOS'
|
||||||
run: |
|
run: |
|
||||||
find ql/ql/src "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 "${CODEQL}" query format --check-only
|
brew install gnu-tar
|
||||||
|
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
|
||||||
|
- name: Find codeql
|
||||||
|
id: find-codeql
|
||||||
|
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
|
||||||
|
with:
|
||||||
|
languages: javascript # does not matter
|
||||||
|
- uses: ./.github/actions/os-version
|
||||||
|
id: os_version
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
ql/target
|
||||||
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-qltest-cargo-${{ hashFiles('ql/rust-toolchain.toml', 'ql/**/Cargo.lock') }}
|
||||||
|
- name: Build extractor
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: |
|
||||||
|
cd ql;
|
||||||
|
codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
|
||||||
|
env "PATH=$PATH:$codeqlpath" ./scripts/create-extractor-pack.sh
|
||||||
|
- name: Build extractor (Windows)
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
cd ql;
|
||||||
|
$Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})"
|
||||||
|
pwsh ./scripts/create-extractor-pack.ps1
|
||||||
|
- name: Run a single QL tests - Unix
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: |
|
||||||
|
"${CODEQL}" test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref
|
||||||
env:
|
env:
|
||||||
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
|
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
|
||||||
|
- name: Run a single QL tests - Windows
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$Env:PATH += ";$(dirname ${{ steps.find-codeql.outputs.codeql-path }})"
|
||||||
|
codeql test run --check-databases --search-path "${{ github.workspace }}/ql/extractor-pack" ql/ql/test/queries/style/DeadCode/DeadCode.qlref
|
||||||
|
|
||||||
28
.github/workflows/ruby-build.yml
vendored
28
.github/workflows/ruby-build.yml
vendored
@@ -48,6 +48,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
brew install gnu-tar
|
brew install gnu-tar
|
||||||
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
|
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
|
||||||
|
- uses: ./.github/actions/os-version
|
||||||
|
id: os_version
|
||||||
- name: Cache entire extractor
|
- name: Cache entire extractor
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
id: cache-extractor
|
id: cache-extractor
|
||||||
@@ -58,7 +60,7 @@ jobs:
|
|||||||
ruby/target/release/ruby-extractor
|
ruby/target/release/ruby-extractor
|
||||||
ruby/target/release/ruby-extractor.exe
|
ruby/target/release/ruby-extractor.exe
|
||||||
ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
|
ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
|
||||||
key: ${{ runner.os }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
|
||||||
- uses: actions/cache@v3
|
- uses: actions/cache@v3
|
||||||
if: steps.cache-extractor.outputs.cache-hit != 'true'
|
if: steps.cache-extractor.outputs.cache-hit != 'true'
|
||||||
with:
|
with:
|
||||||
@@ -66,7 +68,7 @@ jobs:
|
|||||||
~/.cargo/registry
|
~/.cargo/registry
|
||||||
~/.cargo/git
|
~/.cargo/git
|
||||||
ruby/target
|
ruby/target
|
||||||
key: ${{ runner.os }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
|
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
if: steps.cache-extractor.outputs.cache-hit != 'true'
|
if: steps.cache-extractor.outputs.cache-hit != 'true'
|
||||||
run: cargo fmt --all -- --check
|
run: cargo fmt --all -- --check
|
||||||
@@ -203,11 +205,6 @@ jobs:
|
|||||||
- name: Fetch CodeQL
|
- name: Fetch CodeQL
|
||||||
uses: ./.github/actions/fetch-codeql
|
uses: ./.github/actions/fetch-codeql
|
||||||
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
repository: Shopify/example-ruby-app
|
|
||||||
ref: 67a0decc5eb550f3a9228eda53925c3afd40dfe9
|
|
||||||
|
|
||||||
- name: Download Ruby bundle
|
- name: Download Ruby bundle
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
@@ -216,26 +213,15 @@ jobs:
|
|||||||
- name: Unzip Ruby bundle
|
- name: Unzip Ruby bundle
|
||||||
shell: bash
|
shell: bash
|
||||||
run: unzip -q -d "${{ runner.temp }}/ruby-bundle" "${{ runner.temp }}/codeql-ruby-bundle.zip"
|
run: unzip -q -d "${{ runner.temp }}/ruby-bundle" "${{ runner.temp }}/codeql-ruby-bundle.zip"
|
||||||
- name: Prepare test files
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "import codeql.ruby.AST select count(File f)" > "test.ql"
|
|
||||||
echo "| 4 |" > "test.expected"
|
|
||||||
echo 'name: sample-tests
|
|
||||||
version: 0.0.0
|
|
||||||
dependencies:
|
|
||||||
codeql/ruby-all: "*"
|
|
||||||
extractor: ruby
|
|
||||||
tests: .
|
|
||||||
' > qlpack.yml
|
|
||||||
- name: Run QL test
|
- name: Run QL test
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
codeql test run --search-path "${{ runner.temp }}/ruby-bundle" --additional-packs "${{ runner.temp }}/ruby-bundle" .
|
codeql test run --search-path "${{ runner.temp }}/ruby-bundle" --additional-packs "${{ runner.temp }}/ruby-bundle" ruby/ql/test/library-tests/ast/constants/
|
||||||
- name: Create database
|
- name: Create database
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
codeql database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root . ../database
|
codeql database create --search-path "${{ runner.temp }}/ruby-bundle" --language ruby --source-root ruby/ql/test/library-tests/ast/constants/ ../database
|
||||||
- name: Analyze database
|
- name: Analyze database
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ If you have an idea for a query that you would like to share with other CodeQL u
|
|||||||
|
|
||||||
Each language-specific directory contains further subdirectories that group queries based on their `@tags` or purpose.
|
Each language-specific directory contains further subdirectories that group queries based on their `@tags` or purpose.
|
||||||
- Experimental queries and libraries are stored in the `experimental` subdirectory within each language-specific directory in the [CodeQL repository](https://github.com/github/codeql). For example, experimental Java queries and libraries are stored in `java/ql/src/experimental` and any corresponding tests in `java/ql/test/experimental`.
|
- Experimental queries and libraries are stored in the `experimental` subdirectory within each language-specific directory in the [CodeQL repository](https://github.com/github/codeql). For example, experimental Java queries and libraries are stored in `java/ql/src/experimental` and any corresponding tests in `java/ql/test/experimental`.
|
||||||
|
- Experimental queries need to include `experimental` in their `@tags`
|
||||||
- The structure of an `experimental` subdirectory mirrors the structure of its parent directory.
|
- The structure of an `experimental` subdirectory mirrors the structure of its parent directory.
|
||||||
- Select or create an appropriate directory in `experimental` based on the existing directory structure of `experimental` or its parent directory.
|
- Select or create an appropriate directory in `experimental` based on the existing directory structure of `experimental` or its parent directory.
|
||||||
|
|
||||||
|
|||||||
@@ -402,16 +402,6 @@
|
|||||||
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/ControlFlowReachability.qll",
|
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/ControlFlowReachability.qll",
|
||||||
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ControlFlowReachability.qll"
|
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/ControlFlowReachability.qll"
|
||||||
],
|
],
|
||||||
"Inline Test Expectations": [
|
|
||||||
"cpp/ql/test/TestUtilities/InlineExpectationsTest.qll",
|
|
||||||
"csharp/ql/test/TestUtilities/InlineExpectationsTest.qll",
|
|
||||||
"java/ql/test/TestUtilities/InlineExpectationsTest.qll",
|
|
||||||
"python/ql/test/TestUtilities/InlineExpectationsTest.qll",
|
|
||||||
"ruby/ql/test/TestUtilities/InlineExpectationsTest.qll",
|
|
||||||
"ql/ql/test/TestUtilities/InlineExpectationsTest.qll",
|
|
||||||
"go/ql/test/TestUtilities/InlineExpectationsTest.qll",
|
|
||||||
"swift/ql/test/TestUtilities/InlineExpectationsTest.qll"
|
|
||||||
],
|
|
||||||
"C++ ExternalAPIs": [
|
"C++ ExternalAPIs": [
|
||||||
"cpp/ql/src/Security/CWE/CWE-020/ExternalAPIs.qll",
|
"cpp/ql/src/Security/CWE/CWE-020/ExternalAPIs.qll",
|
||||||
"cpp/ql/src/Security/CWE/CWE-020/ir/ExternalAPIs.qll"
|
"cpp/ql/src/Security/CWE/CWE-020/ir/ExternalAPIs.qll"
|
||||||
|
|||||||
@@ -13,5 +13,5 @@ predicate isExprWithNewBuiltin(Expr expr) {
|
|||||||
from Expr expr, int kind, int kind_new, Location location
|
from Expr expr, int kind, int kind_new, Location location
|
||||||
where
|
where
|
||||||
exprs(expr, kind, location) and
|
exprs(expr, kind, location) and
|
||||||
if isExprWithNewBuiltin(expr) then kind_new = 0 else kind_new = kind
|
if isExprWithNewBuiltin(expr) then kind_new = 1 else kind_new = kind
|
||||||
select expr, kind_new, location
|
select expr, kind_new, location
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ class Location extends @location_expr {
|
|||||||
from Expr expr, int kind, int kind_new, Location location
|
from Expr expr, int kind, int kind_new, Location location
|
||||||
where
|
where
|
||||||
exprs(expr, kind, location) and
|
exprs(expr, kind, location) and
|
||||||
if expr instanceof @blockassignexpr then kind_new = 0 else kind_new = kind
|
if expr instanceof @blockassignexpr then kind_new = 1 else kind_new = kind
|
||||||
select expr, kind_new, location
|
select expr, kind_new, location
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
class BuiltinType extends @builtintype {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
from BuiltinType type, string name, int kind, int kind_new, int size, int sign, int alignment
|
||||||
|
where
|
||||||
|
builtintypes(type, name, kind, size, sign, alignment) and
|
||||||
|
if type instanceof @float16 or type instanceof @complex_float16
|
||||||
|
then kind_new = 2
|
||||||
|
else kind_new = kind
|
||||||
|
select type, name, kind_new, size, sign, alignment
|
||||||
2210
cpp/downgrades/a5bb28ed29f73855d64cc5f939cef977fa8fd19a/old.dbscheme
Normal file
2210
cpp/downgrades/a5bb28ed29f73855d64cc5f939cef977fa8fd19a/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
|||||||
|
description: Introduce (_Complex) _Float16 type
|
||||||
|
compatibility: backwards
|
||||||
|
builtintypes.rel: run builtintypes.qlo
|
||||||
2208
cpp/downgrades/ba86bebea4c7a8235c2fa0e220391fbd4446a087/old.dbscheme
Normal file
2208
cpp/downgrades/ba86bebea4c7a8235c2fa0e220391fbd4446a087/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Uncomment case splits in dbscheme
|
||||||
|
compatibility: full
|
||||||
@@ -123,6 +123,13 @@ private predicate constructorCallTypeMention(ConstructorCall cc, TypeMention tm)
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Holds if `loc` has the container `container` and is on the line starting at `startLine`. */
|
||||||
|
pragma[nomagic]
|
||||||
|
private predicate hasContainerAndStartLine(Location loc, Container container, int startLine) {
|
||||||
|
loc.getStartLine() = startLine and
|
||||||
|
loc.getContainer() = container
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an element, of kind `kind`, that element `e` uses, if any.
|
* Gets an element, of kind `kind`, that element `e` uses, if any.
|
||||||
* Attention: This predicate yields multiple definitions for a single location.
|
* Attention: This predicate yields multiple definitions for a single location.
|
||||||
@@ -159,9 +166,9 @@ Top definitionOf(Top e, string kind) {
|
|||||||
// Multiple type mentions can be generated when a typedef is used, and
|
// Multiple type mentions can be generated when a typedef is used, and
|
||||||
// in such cases we want to exclude all but the originating typedef.
|
// in such cases we want to exclude all but the originating typedef.
|
||||||
not exists(Type secondary |
|
not exists(Type secondary |
|
||||||
exists(TypeMention tm, File f, int startline, int startcol |
|
exists(File f, int startline, int startcol |
|
||||||
typeMentionStartLoc(e, result, f, startline, startcol) and
|
typeMentionStartLoc(e, result, f, startline, startcol) and
|
||||||
typeMentionStartLoc(tm, secondary, f, startline, startcol) and
|
typeMentionStartLoc(_, secondary, f, startline, startcol) and
|
||||||
(
|
(
|
||||||
result = secondary.(TypedefType).getBaseType() or
|
result = secondary.(TypedefType).getBaseType() or
|
||||||
result = secondary.(TypedefType).getBaseType().(SpecifiedType).getBaseType()
|
result = secondary.(TypedefType).getBaseType().(SpecifiedType).getBaseType()
|
||||||
@@ -184,11 +191,9 @@ Top definitionOf(Top e, string kind) {
|
|||||||
kind = "I" and
|
kind = "I" and
|
||||||
result = e.(Include).getIncludedFile() and
|
result = e.(Include).getIncludedFile() and
|
||||||
// exclude `#include` directives containing macros
|
// exclude `#include` directives containing macros
|
||||||
not exists(MacroInvocation mi, Location l1, Location l2 |
|
not exists(MacroInvocation mi, Container container, int startLine |
|
||||||
l1 = e.(Include).getLocation() and
|
hasContainerAndStartLine(e.(Include).getLocation(), container, startLine) and
|
||||||
l2 = mi.getLocation() and
|
hasContainerAndStartLine(mi.getLocation(), container, startLine)
|
||||||
l1.getContainer() = l2.getContainer() and
|
|
||||||
l1.getStartLine() = l2.getStartLine()
|
|
||||||
// (an #include directive must be always on it's own line)
|
// (an #include directive must be always on it's own line)
|
||||||
)
|
)
|
||||||
) and
|
) and
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ module Consistency {
|
|||||||
) {
|
) {
|
||||||
none()
|
none()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
|
||||||
|
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
|
||||||
|
none()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
|
||||||
|
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
|
||||||
|
none()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RelevantNode extends Node {
|
private class RelevantNode extends Node {
|
||||||
@@ -101,9 +111,7 @@ module Consistency {
|
|||||||
exists(int c |
|
exists(int c |
|
||||||
c =
|
c =
|
||||||
strictcount(Node n |
|
strictcount(Node n |
|
||||||
not exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
|
not n.hasLocationInfo(_, _, _, _, _) and
|
||||||
n.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
|
||||||
) and
|
|
||||||
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
|
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
|
||||||
) and
|
) and
|
||||||
msg = "Nodes without location: " + c
|
msg = "Nodes without location: " + c
|
||||||
@@ -248,6 +256,7 @@ module Consistency {
|
|||||||
query predicate uniqueParameterNodeAtPosition(
|
query predicate uniqueParameterNodeAtPosition(
|
||||||
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
||||||
) {
|
) {
|
||||||
|
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
|
||||||
isParameterNode(p, c, pos) and
|
isParameterNode(p, c, pos) and
|
||||||
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
|
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
|
||||||
msg = "Parameters with overlapping positions."
|
msg = "Parameters with overlapping positions."
|
||||||
@@ -256,6 +265,7 @@ module Consistency {
|
|||||||
query predicate uniqueParameterNodePosition(
|
query predicate uniqueParameterNodePosition(
|
||||||
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
||||||
) {
|
) {
|
||||||
|
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
|
||||||
isParameterNode(p, c, pos) and
|
isParameterNode(p, c, pos) and
|
||||||
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
|
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
|
||||||
msg = "Parameter node with multiple positions."
|
msg = "Parameter node with multiple positions."
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ private predicate allocation(Instruction array, Length length, int delta) {
|
|||||||
length.(VNLength).getInstruction().getConvertedResultExpression() = lengthExpr
|
length.(VNLength).getInstruction().getConvertedResultExpression() = lengthExpr
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
not exists(int d | deconstructMallocSizeExpr(alloc.getSizeExpr(), _, d)) and
|
not deconstructMallocSizeExpr(alloc.getSizeExpr(), _, _) and
|
||||||
length.(VNLength).getInstruction().getConvertedResultExpression() = alloc.getSizeExpr() and
|
length.(VNLength).getInstruction().getConvertedResultExpression() = alloc.getSizeExpr() and
|
||||||
delta = 0
|
delta = 0
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -543,9 +543,7 @@ private predicate boundedPhiCand(
|
|||||||
PhiInstruction phi, boolean upper, Bound b, int delta, boolean fromBackEdge, int origdelta,
|
PhiInstruction phi, boolean upper, Bound b, int delta, boolean fromBackEdge, int origdelta,
|
||||||
Reason reason
|
Reason reason
|
||||||
) {
|
) {
|
||||||
exists(PhiInputOperand op |
|
boundedPhiInp(phi, _, b, delta, upper, fromBackEdge, origdelta, reason)
|
||||||
boundedPhiInp(phi, op, b, delta, upper, fromBackEdge, origdelta, reason)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -664,9 +664,7 @@ private predicate boundedPhiCand(
|
|||||||
SemSsaPhiNode phi, boolean upper, SemBound b, int delta, boolean fromBackEdge, int origdelta,
|
SemSsaPhiNode phi, boolean upper, SemBound b, int delta, boolean fromBackEdge, int origdelta,
|
||||||
SemReason reason
|
SemReason reason
|
||||||
) {
|
) {
|
||||||
exists(SemSsaVariable inp, SemSsaReadPositionPhiInputEdge edge |
|
boundedPhiInp(phi, _, _, b, delta, upper, fromBackEdge, origdelta, reason)
|
||||||
boundedPhiInp(phi, inp, edge, b, delta, upper, fromBackEdge, origdelta, reason)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: codeql/cpp-all
|
name: codeql/cpp-all
|
||||||
version: 0.5.0
|
version: 0.5.1-dev
|
||||||
groups: cpp
|
groups: cpp
|
||||||
dbscheme: semmlecode.cpp.dbscheme
|
dbscheme: semmlecode.cpp.dbscheme
|
||||||
extractor: cpp
|
extractor: cpp
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
MetricFunction getMetrics() { result = this }
|
MetricFunction getMetrics() { result = this }
|
||||||
|
|
||||||
/** Holds if this function calls the function `f`. */
|
/** Holds if this function calls the function `f`. */
|
||||||
predicate calls(Function f) { exists(Locatable l | this.calls(f, l)) }
|
predicate calls(Function f) { this.calls(f, _) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this function calls the function `f` in the `FunctionCall`
|
* Holds if this function calls the function `f` in the `FunctionCall`
|
||||||
@@ -335,7 +335,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Holds if this function accesses a function or variable or enumerator `a`. */
|
/** Holds if this function accesses a function or variable or enumerator `a`. */
|
||||||
predicate accesses(Declaration a) { exists(Locatable l | this.accesses(a, l)) }
|
predicate accesses(Declaration a) { this.accesses(a, _) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this function accesses a function or variable or enumerator `a`
|
* Holds if this function accesses a function or variable or enumerator `a`
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ import semmle.code.cpp.File
|
|||||||
*/
|
*/
|
||||||
class Location extends @location {
|
class Location extends @location {
|
||||||
/** Gets the container corresponding to this location. */
|
/** Gets the container corresponding to this location. */
|
||||||
|
pragma[nomagic]
|
||||||
Container getContainer() { this.fullLocationInfo(result, _, _, _, _) }
|
Container getContainer() { this.fullLocationInfo(result, _, _, _, _) }
|
||||||
|
|
||||||
/** Gets the file corresponding to this location, if any. */
|
/** Gets the file corresponding to this location, if any. */
|
||||||
File getFile() { result = this.getContainer() }
|
File getFile() { result = this.getContainer() }
|
||||||
|
|
||||||
/** Gets the 1-based line number (inclusive) where this location starts. */
|
/** Gets the 1-based line number (inclusive) where this location starts. */
|
||||||
|
pragma[nomagic]
|
||||||
int getStartLine() { this.fullLocationInfo(_, result, _, _, _) }
|
int getStartLine() { this.fullLocationInfo(_, result, _, _, _) }
|
||||||
|
|
||||||
/** Gets the 1-based column number (inclusive) where this location starts. */
|
/** Gets the 1-based column number (inclusive) where this location starts. */
|
||||||
|
|||||||
@@ -816,6 +816,12 @@ private predicate floatingPointTypeMapping(
|
|||||||
or
|
or
|
||||||
// _Float128x
|
// _Float128x
|
||||||
kind = 50 and base = 2 and domain = TRealDomain() and realKind = 50 and extended = true
|
kind = 50 and base = 2 and domain = TRealDomain() and realKind = 50 and extended = true
|
||||||
|
or
|
||||||
|
// _Float16
|
||||||
|
kind = 52 and base = 2 and domain = TRealDomain() and realKind = 52 and extended = false
|
||||||
|
or
|
||||||
|
// _Complex _Float16
|
||||||
|
kind = 53 and base = 2 and domain = TComplexDomain() and realKind = 52 and extended = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ DependencyOptions getDependencyOptions() { any() }
|
|||||||
class DependsSource extends Element {
|
class DependsSource extends Element {
|
||||||
DependsSource() {
|
DependsSource() {
|
||||||
// not inside a template instantiation
|
// not inside a template instantiation
|
||||||
not exists(Element other | this.isFromTemplateInstantiation(other)) or
|
not this.isFromTemplateInstantiation(_) or
|
||||||
// allow DeclarationEntrys of template specializations
|
// allow DeclarationEntrys of template specializations
|
||||||
this.(DeclarationEntry).getDeclaration().(Function).isConstructedFrom(_) or
|
this.(DeclarationEntry).getDeclaration().(Function).isConstructedFrom(_) or
|
||||||
this.(DeclarationEntry).getDeclaration().(Class).isConstructedFrom(_)
|
this.(DeclarationEntry).getDeclaration().(Class).isConstructedFrom(_)
|
||||||
|
|||||||
@@ -69,12 +69,9 @@ predicate functionContainsDisabledCode(Function f) {
|
|||||||
*/
|
*/
|
||||||
predicate functionContainsPreprocCode(Function f) {
|
predicate functionContainsPreprocCode(Function f) {
|
||||||
// `f` contains a preprocessor branch
|
// `f` contains a preprocessor branch
|
||||||
exists(
|
exists(string file, int pbdStartLine, int fBlockStartLine, int fBlockEndLine |
|
||||||
PreprocessorBranchDirective pbd, string file, int pbdStartLine, int fBlockStartLine,
|
|
||||||
int fBlockEndLine
|
|
||||||
|
|
|
||||||
functionLocation(f, file, fBlockStartLine, fBlockEndLine) and
|
functionLocation(f, file, fBlockStartLine, fBlockEndLine) and
|
||||||
pbdLocation(pbd, file, pbdStartLine) and
|
pbdLocation(_, file, pbdStartLine) and
|
||||||
pbdStartLine <= fBlockEndLine and
|
pbdStartLine <= fBlockEndLine and
|
||||||
pbdStartLine >= fBlockStartLine
|
pbdStartLine >= fBlockStartLine
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -244,9 +244,7 @@ class ScanfFormatLiteral extends Expr {
|
|||||||
/**
|
/**
|
||||||
* Gets the maximum width option of the nth input (empty string if none is given).
|
* Gets the maximum width option of the nth input (empty string if none is given).
|
||||||
*/
|
*/
|
||||||
string getMaxWidthOpt(int n) {
|
string getMaxWidthOpt(int n) { this.parseConvSpec(n, _, result, _, _) }
|
||||||
exists(string spec, string len, string conv | this.parseConvSpec(n, spec, result, len, conv))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum width of the nth input.
|
* Gets the maximum width of the nth input.
|
||||||
@@ -256,18 +254,12 @@ class ScanfFormatLiteral extends Expr {
|
|||||||
/**
|
/**
|
||||||
* Gets the length flag of the nth conversion specifier.
|
* Gets the length flag of the nth conversion specifier.
|
||||||
*/
|
*/
|
||||||
string getLength(int n) {
|
string getLength(int n) { this.parseConvSpec(n, _, _, result, _) }
|
||||||
exists(string spec, string width, string conv |
|
|
||||||
this.parseConvSpec(n, spec, width, result, conv)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the conversion character of the nth conversion specifier.
|
* Gets the conversion character of the nth conversion specifier.
|
||||||
*/
|
*/
|
||||||
string getConversionChar(int n) {
|
string getConversionChar(int n) { this.parseConvSpec(n, _, _, _, result) }
|
||||||
exists(string spec, string width, string len | this.parseConvSpec(n, spec, width, len, result))
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximum length of the string that can be produced by the nth
|
* Gets the maximum length of the string that can be produced by the nth
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class SubBasicBlock extends ControlFlowNodeBase {
|
|||||||
* only condition under which a `SubBasicBlock` may have multiple
|
* only condition under which a `SubBasicBlock` may have multiple
|
||||||
* predecessors.
|
* predecessors.
|
||||||
*/
|
*/
|
||||||
predicate firstInBB() { exists(BasicBlock bb | this.getRankInBasicBlock(bb) = 1) }
|
predicate firstInBB() { this.getRankInBasicBlock(_) = 1 }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this `SubBasicBlock` comes last in its basic block. This is the
|
* Holds if this `SubBasicBlock` comes last in its basic block. This is the
|
||||||
|
|||||||
@@ -441,8 +441,8 @@ library class ExprEvaluator extends int {
|
|||||||
req = mid.(AssignExpr).getRValue()
|
req = mid.(AssignExpr).getRValue()
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
exists(VariableAccess va, Variable v, boolean sub1 |
|
exists(Variable v, boolean sub1 |
|
||||||
this.interestingVariableAccess(e, va, v, sub1) and
|
this.interestingVariableAccess(e, _, v, sub1) and
|
||||||
req = v.getAnAssignedValue() and
|
req = v.getAnAssignedValue() and
|
||||||
(sub1 = true implies not this.ignoreVariableAssignment(e, v, req)) and
|
(sub1 = true implies not this.ignoreVariableAssignment(e, v, req)) and
|
||||||
sub = false
|
sub = false
|
||||||
@@ -876,7 +876,7 @@ private predicate nonAnalyzableVariableDefinition(Variable v, StmtParent def) {
|
|||||||
* empirically to have effect only on a few rare and pathological examples.
|
* empirically to have effect only on a few rare and pathological examples.
|
||||||
*/
|
*/
|
||||||
private predicate tractableVariable(Variable v) {
|
private predicate tractableVariable(Variable v) {
|
||||||
not exists(StmtParent def | nonAnalyzableVariableDefinition(v, def)) or
|
not nonAnalyzableVariableDefinition(v, _) or
|
||||||
strictcount(StmtParent def | nonAnalyzableVariableDefinition(v, def)) < 1000
|
strictcount(StmtParent def | nonAnalyzableVariableDefinition(v, def)) < 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ module Consistency {
|
|||||||
) {
|
) {
|
||||||
none()
|
none()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
|
||||||
|
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
|
||||||
|
none()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
|
||||||
|
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
|
||||||
|
none()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RelevantNode extends Node {
|
private class RelevantNode extends Node {
|
||||||
@@ -101,9 +111,7 @@ module Consistency {
|
|||||||
exists(int c |
|
exists(int c |
|
||||||
c =
|
c =
|
||||||
strictcount(Node n |
|
strictcount(Node n |
|
||||||
not exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
|
not n.hasLocationInfo(_, _, _, _, _) and
|
||||||
n.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
|
||||||
) and
|
|
||||||
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
|
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
|
||||||
) and
|
) and
|
||||||
msg = "Nodes without location: " + c
|
msg = "Nodes without location: " + c
|
||||||
@@ -248,6 +256,7 @@ module Consistency {
|
|||||||
query predicate uniqueParameterNodeAtPosition(
|
query predicate uniqueParameterNodeAtPosition(
|
||||||
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
||||||
) {
|
) {
|
||||||
|
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
|
||||||
isParameterNode(p, c, pos) and
|
isParameterNode(p, c, pos) and
|
||||||
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
|
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
|
||||||
msg = "Parameters with overlapping positions."
|
msg = "Parameters with overlapping positions."
|
||||||
@@ -256,6 +265,7 @@ module Consistency {
|
|||||||
query predicate uniqueParameterNodePosition(
|
query predicate uniqueParameterNodePosition(
|
||||||
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
||||||
) {
|
) {
|
||||||
|
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
|
||||||
isParameterNode(p, c, pos) and
|
isParameterNode(p, c, pos) and
|
||||||
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
|
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
|
||||||
msg = "Parameter node with multiple positions."
|
msg = "Parameter node with multiple positions."
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -450,10 +450,8 @@ module FlowVar_internal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override string toString() {
|
override string toString() {
|
||||||
exists(Expr e |
|
this.definedByExpr(_, _) and
|
||||||
this.definedByExpr(e, _) and
|
|
||||||
result = "assignment to " + v
|
result = "assignment to " + v
|
||||||
)
|
|
||||||
or
|
or
|
||||||
this.definedByInitialValue(_) and
|
this.definedByInitialValue(_) and
|
||||||
result = "initial value of " + v
|
result = "initial value of " + v
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class SubBasicBlock extends ControlFlowNodeBase {
|
|||||||
* only condition under which a `SubBasicBlock` may have multiple
|
* only condition under which a `SubBasicBlock` may have multiple
|
||||||
* predecessors.
|
* predecessors.
|
||||||
*/
|
*/
|
||||||
predicate firstInBB() { exists(BasicBlock bb | this.getRankInBasicBlock(bb) = 1) }
|
predicate firstInBB() { this.getRankInBasicBlock(_) = 1 }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds if this `SubBasicBlock` comes last in its basic block. This is the
|
* Holds if this `SubBasicBlock` comes last in its basic block. This is the
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ module VirtualDispatch {
|
|||||||
* that is, `c` or one of its supertypes overrides `f`.
|
* that is, `c` or one of its supertypes overrides `f`.
|
||||||
*/
|
*/
|
||||||
private predicate cannotInherit(Class c, MemberFunction f) {
|
private predicate cannotInherit(Class c, MemberFunction f) {
|
||||||
exists(Class overridingType, MemberFunction override |
|
exists(MemberFunction override |
|
||||||
cannotInheritHelper(c, f, overridingType, override) and
|
cannotInheritHelper(c, f, _, override) and
|
||||||
override.overrides+(f)
|
override.overrides+(f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class Expr extends StmtParent, @expr {
|
|||||||
Declaration getEnclosingDeclaration() { result = exprEnclosingElement(this) }
|
Declaration getEnclosingDeclaration() { result = exprEnclosingElement(this) }
|
||||||
|
|
||||||
/** Gets a child of this expression. */
|
/** Gets a child of this expression. */
|
||||||
Expr getAChild() { exists(int n | result = this.getChild(n)) }
|
Expr getAChild() { result = this.getChild(_) }
|
||||||
|
|
||||||
/** Gets the parent of this expression, if any. */
|
/** Gets the parent of this expression, if any. */
|
||||||
Element getParent() { exprparents(underlyingElement(this), _, unresolveElement(result)) }
|
Element getParent() { exprparents(underlyingElement(this), _, unresolveElement(result)) }
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -876,9 +876,9 @@ private module Stage1 implements StageSig {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
private predicate revFlowOut(ReturnPosition pos, Configuration config) {
|
||||||
exists(DataFlowCall call, NodeEx out |
|
exists(NodeEx out |
|
||||||
revFlow(out, _, config) and
|
revFlow(out, _, config) and
|
||||||
viableReturnPosOutNodeCandFwd1(call, pos, out, config)
|
viableReturnPosOutNodeCandFwd1(_, pos, out, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,8 +1731,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// flow through a callable
|
// flow through a callable
|
||||||
exists(DataFlowCall call, ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(DataFlowCall call, ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, node, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -1901,8 +1901,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
predicate parameterMayFlowThrough(ParamNodeEx p, Ap ap, Configuration config) {
|
||||||
exists(RetNodeEx ret, ReturnPosition pos |
|
exists(ReturnPosition pos |
|
||||||
returnFlowsThrough(ret, pos, _, _, p, ap, _, config) and
|
returnFlowsThrough(_, pos, _, _, p, ap, _, config) and
|
||||||
parameterFlowsThroughRev(p, ap, pos, _, config)
|
parameterFlowsThroughRev(p, ap, pos, _, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1923,8 +1923,8 @@ private module MkStage<StageSig PrevStage> {
|
|||||||
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
DataFlowCall call, ArgNodeEx arg, FlowState state, ReturnCtx returnCtx, ApOption returnAp,
|
||||||
Ap ap, Configuration config
|
Ap ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(ParamNodeEx p, ReturnPosition pos, Ap innerReturnAp |
|
exists(ParamNodeEx p, Ap innerReturnAp |
|
||||||
revFlowThrough(call, returnCtx, p, state, pos, returnAp, ap, innerReturnAp, config) and
|
revFlowThrough(call, returnCtx, p, state, _, returnAp, ap, innerReturnAp, config) and
|
||||||
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
flowThroughIntoCall(call, arg, p, _, ap, innerReturnAp, config)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -3749,8 +3749,8 @@ private predicate paramFlowsThrough(
|
|||||||
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
ReturnKindExt kind, FlowState state, CallContextCall cc, SummaryCtxSome sc, AccessPath ap,
|
||||||
AccessPathApprox apa, Configuration config
|
AccessPathApprox apa, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PathNodeMid mid, RetNodeEx ret |
|
exists(RetNodeEx ret |
|
||||||
pathNode(mid, ret, state, cc, sc, ap, config, _) and
|
pathNode(_, ret, state, cc, sc, ap, config, _) and
|
||||||
kind = ret.getKind() and
|
kind = ret.getKind() and
|
||||||
apa = ap.getApprox() and
|
apa = ap.getApprox() and
|
||||||
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
parameterFlowThroughAllowed(sc.getParamNode(), kind)
|
||||||
@@ -4212,8 +4212,7 @@ private module FlowExploration {
|
|||||||
ap = TRevPartialNil() and
|
ap = TRevPartialNil() and
|
||||||
exists(config.explorationLimit())
|
exists(config.explorationLimit())
|
||||||
or
|
or
|
||||||
exists(PartialPathNodeRev mid |
|
revPartialPathStep(_, node, state, sc1, sc2, sc3, ap, config) and
|
||||||
revPartialPathStep(mid, node, state, sc1, sc2, sc3, ap, config) and
|
|
||||||
not clearsContentEx(node, ap.getHead()) and
|
not clearsContentEx(node, ap.getHead()) and
|
||||||
(
|
(
|
||||||
notExpectsContent(node) or
|
notExpectsContent(node) or
|
||||||
@@ -4222,7 +4221,6 @@ private module FlowExploration {
|
|||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
distSink(node.getEnclosingCallable(), config) <= config.explorationLimit()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pragma[nomagic]
|
pragma[nomagic]
|
||||||
@@ -4230,8 +4228,7 @@ private module FlowExploration {
|
|||||||
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
NodeEx node, FlowState state, CallContext cc, TSummaryCtx1 sc1, TSummaryCtx2 sc2,
|
||||||
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
TSummaryCtx3 sc3, PartialAccessPath ap, Configuration config
|
||||||
) {
|
) {
|
||||||
exists(PartialPathNodeFwd mid |
|
partialPathStep(_, node, state, cc, sc1, sc2, sc3, ap, config) and
|
||||||
partialPathStep(mid, node, state, cc, sc1, sc2, sc3, ap, config) and
|
|
||||||
not fullBarrier(node, config) and
|
not fullBarrier(node, config) and
|
||||||
not stateBarrier(node, state, config) and
|
not stateBarrier(node, state, config) and
|
||||||
not clearsContentEx(node, ap.getHead().getContent()) and
|
not clearsContentEx(node, ap.getHead().getContent()) and
|
||||||
@@ -4242,7 +4239,6 @@ private module FlowExploration {
|
|||||||
if node.asNode() instanceof CastingNode
|
if node.asNode() instanceof CastingNode
|
||||||
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
then compatibleTypes(node.getDataFlowType(), ap.getType())
|
||||||
else any()
|
else any()
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -45,6 +45,16 @@ module Consistency {
|
|||||||
) {
|
) {
|
||||||
none()
|
none()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodeAtPosition`. */
|
||||||
|
predicate uniqueParameterNodeAtPositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
|
||||||
|
none()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Holds if `(c, pos, p)` should be excluded from the consistency test `uniqueParameterNodePosition`. */
|
||||||
|
predicate uniqueParameterNodePositionExclude(DataFlowCallable c, ParameterPosition pos, Node p) {
|
||||||
|
none()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RelevantNode extends Node {
|
private class RelevantNode extends Node {
|
||||||
@@ -101,9 +111,7 @@ module Consistency {
|
|||||||
exists(int c |
|
exists(int c |
|
||||||
c =
|
c =
|
||||||
strictcount(Node n |
|
strictcount(Node n |
|
||||||
not exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
|
not n.hasLocationInfo(_, _, _, _, _) and
|
||||||
n.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
|
||||||
) and
|
|
||||||
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
|
not any(ConsistencyConfiguration conf).missingLocationExclude(n)
|
||||||
) and
|
) and
|
||||||
msg = "Nodes without location: " + c
|
msg = "Nodes without location: " + c
|
||||||
@@ -248,6 +256,7 @@ module Consistency {
|
|||||||
query predicate uniqueParameterNodeAtPosition(
|
query predicate uniqueParameterNodeAtPosition(
|
||||||
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
||||||
) {
|
) {
|
||||||
|
not any(ConsistencyConfiguration conf).uniqueParameterNodeAtPositionExclude(c, pos, p) and
|
||||||
isParameterNode(p, c, pos) and
|
isParameterNode(p, c, pos) and
|
||||||
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
|
not exists(unique(Node p0 | isParameterNode(p0, c, pos))) and
|
||||||
msg = "Parameters with overlapping positions."
|
msg = "Parameters with overlapping positions."
|
||||||
@@ -256,6 +265,7 @@ module Consistency {
|
|||||||
query predicate uniqueParameterNodePosition(
|
query predicate uniqueParameterNodePosition(
|
||||||
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
DataFlowCallable c, ParameterPosition pos, Node p, string msg
|
||||||
) {
|
) {
|
||||||
|
not any(ConsistencyConfiguration conf).uniqueParameterNodePositionExclude(c, pos, p) and
|
||||||
isParameterNode(p, c, pos) and
|
isParameterNode(p, c, pos) and
|
||||||
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
|
not exists(unique(ParameterPosition pos0 | isParameterNode(p, c, pos0))) and
|
||||||
msg = "Parameter node with multiple positions."
|
msg = "Parameter node with multiple positions."
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ private newtype TOpcode =
|
|||||||
TNegate() or
|
TNegate() or
|
||||||
TShiftLeft() or
|
TShiftLeft() or
|
||||||
TShiftRight() or
|
TShiftRight() or
|
||||||
|
TUnsignedShiftRight() or
|
||||||
TBitAnd() or
|
TBitAnd() or
|
||||||
TBitOr() or
|
TBitOr() or
|
||||||
TBitXor() or
|
TBitXor() or
|
||||||
@@ -652,6 +653,15 @@ module Opcode {
|
|||||||
final override string toString() { result = "ShiftRight" }
|
final override string toString() { result = "ShiftRight" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The `Opcode` for a `UnsignedShiftRightInstruction`.
|
||||||
|
*
|
||||||
|
* See the `UnsignedShiftRightInstruction` documentation for more details.
|
||||||
|
*/
|
||||||
|
class UnsignedShiftRight extends BinaryBitwiseOpcode, TUnsignedShiftRight {
|
||||||
|
final override string toString() { result = "UnsignedShiftRight" }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `Opcode` for a `BitAndInstruction`.
|
* The `Opcode` for a `BitAndInstruction`.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1204,6 +1204,17 @@ class ShiftRightInstruction extends BinaryBitwiseInstruction {
|
|||||||
ShiftRightInstruction() { this.getOpcode() instanceof Opcode::ShiftRight }
|
ShiftRightInstruction() { this.getOpcode() instanceof Opcode::ShiftRight }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An instruction that shifts its left operand to the right by the number of bits specified by its
|
||||||
|
* right operand.
|
||||||
|
*
|
||||||
|
* Both operands must have an integer type. The result has the same type as the left operand.
|
||||||
|
* The leftmost bits are zero-filled.
|
||||||
|
*/
|
||||||
|
class UnsignedShiftRightInstruction extends BinaryBitwiseInstruction {
|
||||||
|
UnsignedShiftRightInstruction() { this.getOpcode() instanceof Opcode::UnsignedShiftRight }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An instruction that performs a binary arithmetic operation involving at least one pointer
|
* An instruction that performs a binary arithmetic operation involving at least one pointer
|
||||||
* operand.
|
* operand.
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Operand extends TStageOperand {
|
|||||||
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
exists(Instruction use | this = chiOperand(use, _))
|
this = chiOperand(_, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this element. */
|
/** Gets a textual representation of this element. */
|
||||||
|
|||||||
@@ -329,12 +329,12 @@ private module Cached {
|
|||||||
cached
|
cached
|
||||||
Instruction getChiInstructionTotalOperand(ChiInstruction chiInstr) {
|
Instruction getChiInstructionTotalOperand(ChiInstruction chiInstr) {
|
||||||
exists(
|
exists(
|
||||||
Alias::VirtualVariable vvar, OldInstruction oldInstr, Alias::MemoryLocation defLocation,
|
Alias::VirtualVariable vvar, OldInstruction oldInstr, OldBlock defBlock, int defRank,
|
||||||
OldBlock defBlock, int defRank, int defOffset, OldBlock useBlock, int useRank
|
int defOffset, OldBlock useBlock, int useRank
|
||||||
|
|
|
|
||||||
chiInstr = getChi(oldInstr) and
|
chiInstr = getChi(oldInstr) and
|
||||||
vvar = Alias::getResultMemoryLocation(oldInstr).getVirtualVariable() and
|
vvar = Alias::getResultMemoryLocation(oldInstr).getVirtualVariable() and
|
||||||
hasDefinitionAtRank(vvar, defLocation, defBlock, defRank, defOffset) and
|
hasDefinitionAtRank(vvar, _, defBlock, defRank, defOffset) and
|
||||||
hasUseAtRank(vvar, useBlock, useRank, oldInstr) and
|
hasUseAtRank(vvar, useBlock, useRank, oldInstr) and
|
||||||
definitionReachesUse(vvar, defBlock, defRank, useBlock, useRank) and
|
definitionReachesUse(vvar, defBlock, defRank, useBlock, useRank) and
|
||||||
result = getDefinitionOrChiInstruction(defBlock, defOffset, vvar, _)
|
result = getDefinitionOrChiInstruction(defBlock, defOffset, vvar, _)
|
||||||
|
|||||||
@@ -1204,6 +1204,17 @@ class ShiftRightInstruction extends BinaryBitwiseInstruction {
|
|||||||
ShiftRightInstruction() { this.getOpcode() instanceof Opcode::ShiftRight }
|
ShiftRightInstruction() { this.getOpcode() instanceof Opcode::ShiftRight }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An instruction that shifts its left operand to the right by the number of bits specified by its
|
||||||
|
* right operand.
|
||||||
|
*
|
||||||
|
* Both operands must have an integer type. The result has the same type as the left operand.
|
||||||
|
* The leftmost bits are zero-filled.
|
||||||
|
*/
|
||||||
|
class UnsignedShiftRightInstruction extends BinaryBitwiseInstruction {
|
||||||
|
UnsignedShiftRightInstruction() { this.getOpcode() instanceof Opcode::UnsignedShiftRight }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An instruction that performs a binary arithmetic operation involving at least one pointer
|
* An instruction that performs a binary arithmetic operation involving at least one pointer
|
||||||
* operand.
|
* operand.
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Operand extends TStageOperand {
|
|||||||
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
exists(Instruction use | this = chiOperand(use, _))
|
this = chiOperand(_, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this element. */
|
/** Gets a textual representation of this element. */
|
||||||
|
|||||||
@@ -298,11 +298,11 @@ class TranslatedStringLiteralInitialization extends TranslatedDirectInitializati
|
|||||||
opcode instanceof Opcode::Store and
|
opcode instanceof Opcode::Store and
|
||||||
resultType = getTypeForPRValue(expr.getType())
|
resultType = getTypeForPRValue(expr.getType())
|
||||||
or
|
or
|
||||||
exists(int startIndex, int elementCount |
|
exists(int elementCount |
|
||||||
// If the initializer string isn't large enough to fill the target, then
|
// If the initializer string isn't large enough to fill the target, then
|
||||||
// we have to generate another instruction sequence to store a constant
|
// we have to generate another instruction sequence to store a constant
|
||||||
// zero into the remainder of the array.
|
// zero into the remainder of the array.
|
||||||
zeroInitRange(startIndex, elementCount) and
|
zeroInitRange(_, elementCount) and
|
||||||
(
|
(
|
||||||
// Create a constant zero whose size is the size of the remaining
|
// Create a constant zero whose size is the size of the remaining
|
||||||
// space in the target array.
|
// space in the target array.
|
||||||
|
|||||||
@@ -1204,6 +1204,17 @@ class ShiftRightInstruction extends BinaryBitwiseInstruction {
|
|||||||
ShiftRightInstruction() { this.getOpcode() instanceof Opcode::ShiftRight }
|
ShiftRightInstruction() { this.getOpcode() instanceof Opcode::ShiftRight }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An instruction that shifts its left operand to the right by the number of bits specified by its
|
||||||
|
* right operand.
|
||||||
|
*
|
||||||
|
* Both operands must have an integer type. The result has the same type as the left operand.
|
||||||
|
* The leftmost bits are zero-filled.
|
||||||
|
*/
|
||||||
|
class UnsignedShiftRightInstruction extends BinaryBitwiseInstruction {
|
||||||
|
UnsignedShiftRightInstruction() { this.getOpcode() instanceof Opcode::UnsignedShiftRight }
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An instruction that performs a binary arithmetic operation involving at least one pointer
|
* An instruction that performs a binary arithmetic operation involving at least one pointer
|
||||||
* operand.
|
* operand.
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ class Operand extends TStageOperand {
|
|||||||
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
this = reusedPhiOperand(use, def, predecessorBlock, _)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
exists(Instruction use | this = chiOperand(use, _))
|
this = chiOperand(_, _)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a textual representation of this element. */
|
/** Gets a textual representation of this element. */
|
||||||
|
|||||||
@@ -329,12 +329,12 @@ private module Cached {
|
|||||||
cached
|
cached
|
||||||
Instruction getChiInstructionTotalOperand(ChiInstruction chiInstr) {
|
Instruction getChiInstructionTotalOperand(ChiInstruction chiInstr) {
|
||||||
exists(
|
exists(
|
||||||
Alias::VirtualVariable vvar, OldInstruction oldInstr, Alias::MemoryLocation defLocation,
|
Alias::VirtualVariable vvar, OldInstruction oldInstr, OldBlock defBlock, int defRank,
|
||||||
OldBlock defBlock, int defRank, int defOffset, OldBlock useBlock, int useRank
|
int defOffset, OldBlock useBlock, int useRank
|
||||||
|
|
|
|
||||||
chiInstr = getChi(oldInstr) and
|
chiInstr = getChi(oldInstr) and
|
||||||
vvar = Alias::getResultMemoryLocation(oldInstr).getVirtualVariable() and
|
vvar = Alias::getResultMemoryLocation(oldInstr).getVirtualVariable() and
|
||||||
hasDefinitionAtRank(vvar, defLocation, defBlock, defRank, defOffset) and
|
hasDefinitionAtRank(vvar, _, defBlock, defRank, defOffset) and
|
||||||
hasUseAtRank(vvar, useBlock, useRank, oldInstr) and
|
hasUseAtRank(vvar, useBlock, useRank, oldInstr) and
|
||||||
definitionReachesUse(vvar, defBlock, defRank, useBlock, useRank) and
|
definitionReachesUse(vvar, defBlock, defRank, useBlock, useRank) and
|
||||||
result = getDefinitionOrChiInstruction(defBlock, defOffset, vvar, _)
|
result = getDefinitionOrChiInstruction(defBlock, defOffset, vvar, _)
|
||||||
|
|||||||
@@ -67,9 +67,7 @@ class Class = Cpp::Class; // Used for inheritance conversions
|
|||||||
|
|
||||||
predicate getIdentityString = Print::getIdentityString/1;
|
predicate getIdentityString = Print::getIdentityString/1;
|
||||||
|
|
||||||
predicate hasCaseEdge(string minValue, string maxValue) {
|
predicate hasCaseEdge(string minValue, string maxValue) { hasCaseEdge(_, minValue, maxValue) }
|
||||||
exists(Cpp::SwitchCase switchCase | hasCaseEdge(switchCase, minValue, maxValue))
|
|
||||||
}
|
|
||||||
|
|
||||||
predicate hasPositionalArgIndex(int argIndex) {
|
predicate hasPositionalArgIndex(int argIndex) {
|
||||||
exists(Cpp::FunctionCall call | exists(call.getArgument(argIndex))) or
|
exists(Cpp::FunctionCall call | exists(call.getArgument(argIndex))) or
|
||||||
|
|||||||
@@ -99,10 +99,10 @@ class MetricClass extends Class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets any method that accesses some local field. */
|
/** Gets any method that accesses some local field. */
|
||||||
Function getAccessingMethod() { exists(Field f | this.accessesLocalField(result, f)) }
|
Function getAccessingMethod() { this.accessesLocalField(result, _) }
|
||||||
|
|
||||||
/** Gets any field that is accessed by a local method. */
|
/** Gets any field that is accessed by a local method. */
|
||||||
Field getAccessedField() { exists(Function func | this.accessesLocalField(func, result)) }
|
Field getAccessedField() { this.accessesLocalField(_, result) }
|
||||||
|
|
||||||
/** Gets the Henderson-Sellers lack-of-cohesion metric. */
|
/** Gets the Henderson-Sellers lack-of-cohesion metric. */
|
||||||
float getLackOfCohesionHS() {
|
float getLackOfCohesionHS() {
|
||||||
@@ -517,10 +517,10 @@ private predicate dependsOnClassSimple(Class source, Class dest) {
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// a class depends on classes for which a call to its member function is done from a function
|
// a class depends on classes for which a call to its member function is done from a function
|
||||||
exists(MemberFunction target, MemberFunction f, Locatable l |
|
exists(MemberFunction target, MemberFunction f |
|
||||||
f.getDeclaringType() = source and
|
f.getDeclaringType() = source and
|
||||||
f instanceof MemberFunction and
|
f instanceof MemberFunction and
|
||||||
f.calls(target, l) and
|
f.calls(target, _) and
|
||||||
target instanceof MemberFunction and
|
target instanceof MemberFunction and
|
||||||
target.getDeclaringType() = dest
|
target.getDeclaringType() = dest
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -133,13 +133,15 @@ abstract class HeuristicAllocationExpr extends Expr {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a constant multiplier for the allocation size given by `getSizeExpr`,
|
* Gets a constant multiplier for the allocation size given by `getSizeExpr`,
|
||||||
* in bytes.
|
* in bytes. This predicate should be used with caution as it can be
|
||||||
|
* inaccurate for allocations identified using heuristics.
|
||||||
*/
|
*/
|
||||||
int getSizeMult() { none() }
|
int getSizeMult() { none() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the size of this allocation in bytes, if it is a fixed size and that
|
* Gets the size of this allocation in bytes, if it is a fixed size and that
|
||||||
* size can be determined.
|
* size can be determined. This predicate should be used with caution as it
|
||||||
|
* can be inaccurate for allocations identified using heuristics.
|
||||||
*/
|
*/
|
||||||
int getSizeBytes() { none() }
|
int getSizeBytes() { none() }
|
||||||
|
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ private predicate analyzableExpr(Expr e) {
|
|||||||
or
|
or
|
||||||
// Also allow variable accesses, provided that they have SSA
|
// Also allow variable accesses, provided that they have SSA
|
||||||
// information.
|
// information.
|
||||||
exists(RangeSsaDefinition def, StackVariable v | e = def.getAUse(v))
|
exists(RangeSsaDefinition def | e = def.getAUse(_))
|
||||||
or
|
or
|
||||||
e instanceof UnsignedBitwiseAndExpr
|
e instanceof UnsignedBitwiseAndExpr
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -127,9 +127,9 @@ deprecated private predicate betweenFunctionsValueMoveTo(
|
|||||||
not unreachable(src) and
|
not unreachable(src) and
|
||||||
not unreachable(dest) and
|
not unreachable(dest) and
|
||||||
(
|
(
|
||||||
exists(Call call, Function called, int i |
|
exists(Call call, int i |
|
||||||
src = call.getArgument(i) and
|
src = call.getArgument(i) and
|
||||||
resolveCallWithParam(call, called, i, dest) and
|
resolveCallWithParam(call, _, i, dest) and
|
||||||
destFromArg = true
|
destFromArg = true
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
@@ -151,8 +151,8 @@ deprecated private predicate betweenFunctionsValueMoveTo(
|
|||||||
)
|
)
|
||||||
or
|
or
|
||||||
// If a parameter of type reference is tainted inside a function, taint the argument too
|
// If a parameter of type reference is tainted inside a function, taint the argument too
|
||||||
exists(Call call, Function f, int pi, Parameter p |
|
exists(Call call, int pi, Parameter p |
|
||||||
resolveCallWithParam(call, f, pi, p) and
|
resolveCallWithParam(call, _, pi, p) and
|
||||||
p.getType() instanceof ReferenceType and
|
p.getType() instanceof ReferenceType and
|
||||||
src = p and
|
src = p and
|
||||||
dest = call.getArgument(pi) and
|
dest = call.getArgument(pi) and
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class Stmt extends StmtParent, @stmt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Gets a child of this statement. */
|
/** Gets a child of this statement. */
|
||||||
Element getAChild() { exists(int n | result = this.getChild(n)) }
|
Element getAChild() { result = this.getChild(_) }
|
||||||
|
|
||||||
/** Gets the parent of this statement, if any. */
|
/** Gets the parent of this statement, if any. */
|
||||||
StmtParent getParent() { stmtparents(underlyingElement(this), _, unresolveElement(result)) }
|
StmtParent getParent() { stmtparents(underlyingElement(this), _, unresolveElement(result)) }
|
||||||
|
|||||||
@@ -475,9 +475,7 @@ private predicate mk_NonmemberFunctionCall(Function fcn, HC_Args args, FunctionC
|
|||||||
fc.getTarget() = fcn and
|
fc.getTarget() = fcn and
|
||||||
analyzableNonmemberFunctionCall(fc) and
|
analyzableNonmemberFunctionCall(fc) and
|
||||||
(
|
(
|
||||||
exists(HashCons head, HC_Args tail |
|
mk_ArgConsInner(_, _, fc.getNumberOfArguments() - 1, args, fc)
|
||||||
mk_ArgConsInner(head, tail, fc.getNumberOfArguments() - 1, args, fc)
|
|
||||||
)
|
|
||||||
or
|
or
|
||||||
fc.getNumberOfArguments() = 0 and
|
fc.getNumberOfArguments() = 0 and
|
||||||
args = HC_EmptyArgs()
|
args = HC_EmptyArgs()
|
||||||
@@ -494,9 +492,7 @@ private predicate analyzableExprCall(ExprCall ec) {
|
|||||||
private predicate mk_ExprCall(HashCons hc, HC_Args args, ExprCall ec) {
|
private predicate mk_ExprCall(HashCons hc, HC_Args args, ExprCall ec) {
|
||||||
hc.getAnExpr() = ec.getExpr() and
|
hc.getAnExpr() = ec.getExpr() and
|
||||||
(
|
(
|
||||||
exists(HashCons head, HC_Args tail |
|
mk_ArgConsInner(_, _, ec.getNumberOfArguments() - 1, args, ec)
|
||||||
mk_ArgConsInner(head, tail, ec.getNumberOfArguments() - 1, args, ec)
|
|
||||||
)
|
|
||||||
or
|
or
|
||||||
ec.getNumberOfArguments() = 0 and
|
ec.getNumberOfArguments() = 0 and
|
||||||
args = HC_EmptyArgs()
|
args = HC_EmptyArgs()
|
||||||
@@ -516,9 +512,7 @@ private predicate mk_MemberFunctionCall(Function fcn, HashCons qual, HC_Args arg
|
|||||||
analyzableMemberFunctionCall(fc) and
|
analyzableMemberFunctionCall(fc) and
|
||||||
hashCons(fc.getQualifier().getFullyConverted()) = qual and
|
hashCons(fc.getQualifier().getFullyConverted()) = qual and
|
||||||
(
|
(
|
||||||
exists(HashCons head, HC_Args tail |
|
mk_ArgConsInner(_, _, fc.getNumberOfArguments() - 1, args, fc)
|
||||||
mk_ArgConsInner(head, tail, fc.getNumberOfArguments() - 1, args, fc)
|
|
||||||
)
|
|
||||||
or
|
or
|
||||||
fc.getNumberOfArguments() = 0 and
|
fc.getNumberOfArguments() = 0 and
|
||||||
args = HC_EmptyArgs()
|
args = HC_EmptyArgs()
|
||||||
@@ -541,10 +535,8 @@ private predicate mk_ArgCons(HashCons hc, int i, HC_Args list, Call c) {
|
|||||||
analyzableCall(c) and
|
analyzableCall(c) and
|
||||||
hc = hashCons(c.getArgument(i).getFullyConverted()) and
|
hc = hashCons(c.getArgument(i).getFullyConverted()) and
|
||||||
(
|
(
|
||||||
exists(HashCons head, HC_Args tail |
|
mk_ArgConsInner(_, _, i - 1, list, c) and
|
||||||
mk_ArgConsInner(head, tail, i - 1, list, c) and
|
|
||||||
i > 0
|
i > 0
|
||||||
)
|
|
||||||
or
|
or
|
||||||
i = 0 and
|
i = 0 and
|
||||||
list = HC_EmptyArgs()
|
list = HC_EmptyArgs()
|
||||||
|
|||||||
@@ -303,12 +303,11 @@ affectedbymacroexpansion(
|
|||||||
int inv: @macroinvocation ref
|
int inv: @macroinvocation ref
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
case @macroinvocation.kind of
|
||||||
case @macroinvocations.kind of
|
1 = @macro_expansion
|
||||||
1 = macro expansion
|
| 2 = @other_macro_reference
|
||||||
| 2 = other macro reference
|
|
||||||
;
|
;
|
||||||
*/
|
|
||||||
macroinvocations(
|
macroinvocations(
|
||||||
unique int id: @macroinvocation,
|
unique int id: @macroinvocation,
|
||||||
int macro_id: @ppd_define ref,
|
int macro_id: @ppd_define ref,
|
||||||
@@ -346,27 +345,36 @@ macro_argument_expanded(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
case @function.kind of
|
case @function.kind of
|
||||||
1 = normal
|
1 = @normal_function
|
||||||
| 2 = constructor
|
| 2 = @constructor
|
||||||
| 3 = destructor
|
| 3 = @destructor
|
||||||
| 4 = conversion
|
| 4 = @conversion_function
|
||||||
| 5 = operator
|
| 5 = @operator
|
||||||
| 6 = builtin // GCC built-in functions, e.g. __builtin___memcpy_chk
|
| 6 = @builtin_function // GCC built-in functions, e.g. __builtin___memcpy_chk
|
||||||
;
|
;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
functions(
|
functions(
|
||||||
unique int id: @function,
|
unique int id: @function,
|
||||||
string name: string ref,
|
string name: string ref,
|
||||||
int kind: int ref
|
int kind: int ref
|
||||||
);
|
);
|
||||||
|
|
||||||
function_entry_point(int id: @function ref, unique int entry_point: @stmt ref);
|
function_entry_point(
|
||||||
|
int id: @function ref,
|
||||||
|
unique int entry_point: @stmt ref
|
||||||
|
);
|
||||||
|
|
||||||
function_return_type(int id: @function ref, int return_type: @type ref);
|
function_return_type(
|
||||||
|
int id: @function ref,
|
||||||
|
int return_type: @type ref
|
||||||
|
);
|
||||||
|
|
||||||
/** If `function` is a coroutine, then this gives the
|
/**
|
||||||
std::experimental::resumable_traits instance associated with it,
|
* If `function` is a coroutine, then this gives the `std::experimental::resumable_traits`
|
||||||
and the variables representing the `handle` and `promise` for it. */
|
* instance associated with it, and the variables representing the `handle` and `promise`
|
||||||
|
* for it.
|
||||||
|
*/
|
||||||
coroutine(
|
coroutine(
|
||||||
unique int function: @function ref,
|
unique int function: @function ref,
|
||||||
int traits: @type ref,
|
int traits: @type ref,
|
||||||
@@ -392,7 +400,10 @@ function_deleted(unique int id: @function ref);
|
|||||||
|
|
||||||
function_defaulted(unique int id: @function ref);
|
function_defaulted(unique int id: @function ref);
|
||||||
|
|
||||||
member_function_this_type(unique int id: @function ref, int this_type: @type ref);
|
member_function_this_type(
|
||||||
|
unique int id: @function ref,
|
||||||
|
int this_type: @type ref
|
||||||
|
);
|
||||||
|
|
||||||
#keyset[id, type_id]
|
#keyset[id, type_id]
|
||||||
fun_decls(
|
fun_decls(
|
||||||
@@ -495,7 +506,10 @@ params(
|
|||||||
int type_id: @type ref
|
int type_id: @type ref
|
||||||
);
|
);
|
||||||
|
|
||||||
overrides(int new: @function ref, int old: @function ref);
|
overrides(
|
||||||
|
int new: @function ref,
|
||||||
|
int old: @function ref
|
||||||
|
);
|
||||||
|
|
||||||
#keyset[id, type_id]
|
#keyset[id, type_id]
|
||||||
membervariables(
|
membervariables(
|
||||||
@@ -541,63 +555,65 @@ enumconstants(
|
|||||||
|
|
||||||
@localscopevariable = @localvariable | @parameter;
|
@localscopevariable = @localvariable | @parameter;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Built-in types are the fundamental types, e.g., integral, floating, and void.
|
* Built-in types are the fundamental types, e.g., integral, floating, and void.
|
||||||
|
|
||||||
case @builtintype.kind of
|
|
||||||
1 = error
|
|
||||||
| 2 = unknown
|
|
||||||
| 3 = void
|
|
||||||
| 4 = boolean
|
|
||||||
| 5 = char
|
|
||||||
| 6 = unsigned_char
|
|
||||||
| 7 = signed_char
|
|
||||||
| 8 = short
|
|
||||||
| 9 = unsigned_short
|
|
||||||
| 10 = signed_short
|
|
||||||
| 11 = int
|
|
||||||
| 12 = unsigned_int
|
|
||||||
| 13 = signed_int
|
|
||||||
| 14 = long
|
|
||||||
| 15 = unsigned_long
|
|
||||||
| 16 = signed_long
|
|
||||||
| 17 = long_long
|
|
||||||
| 18 = unsigned_long_long
|
|
||||||
| 19 = signed_long_long
|
|
||||||
| 20 = __int8 // Microsoft-specific
|
|
||||||
| 21 = __int16 // Microsoft-specific
|
|
||||||
| 22 = __int32 // Microsoft-specific
|
|
||||||
| 23 = __int64 // Microsoft-specific
|
|
||||||
| 24 = float
|
|
||||||
| 25 = double
|
|
||||||
| 26 = long_double
|
|
||||||
| 27 = _Complex_float // C99-specific
|
|
||||||
| 28 = _Complex_double // C99-specific
|
|
||||||
| 29 = _Complex_long double // C99-specific
|
|
||||||
| 30 = _Imaginary_float // C99-specific
|
|
||||||
| 31 = _Imaginary_double // C99-specific
|
|
||||||
| 32 = _Imaginary_long_double // C99-specific
|
|
||||||
| 33 = wchar_t // Microsoft-specific
|
|
||||||
| 34 = decltype_nullptr // C++11
|
|
||||||
| 35 = __int128
|
|
||||||
| 36 = unsigned___int128
|
|
||||||
| 37 = signed___int128
|
|
||||||
| 38 = __float128
|
|
||||||
| 39 = _Complex___float128
|
|
||||||
| 40 = _Decimal32
|
|
||||||
| 41 = _Decimal64
|
|
||||||
| 42 = _Decimal128
|
|
||||||
| 43 = char16_t
|
|
||||||
| 44 = char32_t
|
|
||||||
| 45 = _Float32
|
|
||||||
| 46 = _Float32x
|
|
||||||
| 47 = _Float64
|
|
||||||
| 48 = _Float64x
|
|
||||||
| 49 = _Float128
|
|
||||||
| 50 = _Float128x
|
|
||||||
| 51 = char8_t
|
|
||||||
;
|
|
||||||
*/
|
*/
|
||||||
|
case @builtintype.kind of
|
||||||
|
1 = @errortype
|
||||||
|
| 2 = @unknowntype
|
||||||
|
| 3 = @void
|
||||||
|
| 4 = @boolean
|
||||||
|
| 5 = @char
|
||||||
|
| 6 = @unsigned_char
|
||||||
|
| 7 = @signed_char
|
||||||
|
| 8 = @short
|
||||||
|
| 9 = @unsigned_short
|
||||||
|
| 10 = @signed_short
|
||||||
|
| 11 = @int
|
||||||
|
| 12 = @unsigned_int
|
||||||
|
| 13 = @signed_int
|
||||||
|
| 14 = @long
|
||||||
|
| 15 = @unsigned_long
|
||||||
|
| 16 = @signed_long
|
||||||
|
| 17 = @long_long
|
||||||
|
| 18 = @unsigned_long_long
|
||||||
|
| 19 = @signed_long_long
|
||||||
|
// ... 20 Microsoft-specific __int8
|
||||||
|
// ... 21 Microsoft-specific __int16
|
||||||
|
// ... 22 Microsoft-specific __int32
|
||||||
|
// ... 23 Microsoft-specific __int64
|
||||||
|
| 24 = @float
|
||||||
|
| 25 = @double
|
||||||
|
| 26 = @long_double
|
||||||
|
| 27 = @complex_float // C99-specific _Complex float
|
||||||
|
| 28 = @complex_double // C99-specific _Complex double
|
||||||
|
| 29 = @complex_long_double // C99-specific _Complex long double
|
||||||
|
| 30 = @imaginary_float // C99-specific _Imaginary float
|
||||||
|
| 31 = @imaginary_double // C99-specific _Imaginary double
|
||||||
|
| 32 = @imaginary_long_double // C99-specific _Imaginary long double
|
||||||
|
| 33 = @wchar_t // Microsoft-specific
|
||||||
|
| 34 = @decltype_nullptr // C++11
|
||||||
|
| 35 = @int128 // __int128
|
||||||
|
| 36 = @unsigned_int128 // unsigned __int128
|
||||||
|
| 37 = @signed_int128 // signed __int128
|
||||||
|
| 38 = @float128 // __float128
|
||||||
|
| 39 = @complex_float128 // _Complex __float128
|
||||||
|
| 40 = @decimal32 // _Decimal32
|
||||||
|
| 41 = @decimal64 // _Decimal64
|
||||||
|
| 42 = @decimal128 // _Decimal128
|
||||||
|
| 43 = @char16_t
|
||||||
|
| 44 = @char32_t
|
||||||
|
| 45 = @std_float32 // _Float32
|
||||||
|
| 46 = @float32x // _Float32x
|
||||||
|
| 47 = @std_float64 // _Float64
|
||||||
|
| 48 = @float64x // _Float64x
|
||||||
|
| 49 = @std_float128 // _Float128
|
||||||
|
| 50 = @float128x // _Float128x
|
||||||
|
| 51 = @char8_t
|
||||||
|
| 52 = @float16 // _Float16
|
||||||
|
| 53 = @complex_float16 // _Complex _Float16
|
||||||
|
;
|
||||||
|
|
||||||
builtintypes(
|
builtintypes(
|
||||||
unique int id: @builtintype,
|
unique int id: @builtintype,
|
||||||
string name: string ref,
|
string name: string ref,
|
||||||
@@ -607,23 +623,23 @@ builtintypes(
|
|||||||
int alignment: int ref
|
int alignment: int ref
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/**
|
||||||
Derived types are types that are directly derived from existing types and
|
* Derived types are types that are directly derived from existing types and
|
||||||
point to, refer to, transform type data to return a new type.
|
* point to, refer to, transform type data to return a new type.
|
||||||
|
|
||||||
case @derivedtype.kind of
|
|
||||||
1 = pointer
|
|
||||||
| 2 = reference
|
|
||||||
| 3 = type_with_specifiers
|
|
||||||
| 4 = array
|
|
||||||
| 5 = gnu_vector
|
|
||||||
| 6 = routineptr
|
|
||||||
| 7 = routinereference
|
|
||||||
| 8 = rvalue_reference // C++11
|
|
||||||
// ... 9 type_conforming_to_protocols deprecated
|
|
||||||
| 10 = block
|
|
||||||
;
|
|
||||||
*/
|
*/
|
||||||
|
case @derivedtype.kind of
|
||||||
|
1 = @pointer
|
||||||
|
| 2 = @reference
|
||||||
|
| 3 = @type_with_specifiers
|
||||||
|
| 4 = @array
|
||||||
|
| 5 = @gnu_vector
|
||||||
|
| 6 = @routineptr
|
||||||
|
| 7 = @routinereference
|
||||||
|
| 8 = @rvalue_reference // C++11
|
||||||
|
// ... 9 type_conforming_to_protocols deprecated
|
||||||
|
| 10 = @block
|
||||||
|
;
|
||||||
|
|
||||||
derivedtypes(
|
derivedtypes(
|
||||||
unique int id: @derivedtype,
|
unique int id: @derivedtype,
|
||||||
string name: string ref,
|
string name: string ref,
|
||||||
@@ -676,22 +692,23 @@ decltypes(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
case @usertype.kind of
|
case @usertype.kind of
|
||||||
1 = struct
|
1 = @struct
|
||||||
| 2 = class
|
| 2 = @class
|
||||||
| 3 = union
|
| 3 = @union
|
||||||
| 4 = enum
|
| 4 = @enum
|
||||||
| 5 = typedef // classic C: typedef typedef type name
|
| 5 = @typedef // classic C: typedef typedef type name
|
||||||
| 6 = template
|
| 6 = @template
|
||||||
| 7 = template_parameter
|
| 7 = @template_parameter
|
||||||
| 8 = template_template_parameter
|
| 8 = @template_template_parameter
|
||||||
| 9 = proxy_class // a proxy class associated with a template parameter
|
| 9 = @proxy_class // a proxy class associated with a template parameter
|
||||||
// ... 10 objc_class deprecated
|
// ... 10 objc_class deprecated
|
||||||
// ... 11 objc_protocol deprecated
|
// ... 11 objc_protocol deprecated
|
||||||
// ... 12 objc_category deprecated
|
// ... 12 objc_category deprecated
|
||||||
| 13 = scoped_enum
|
| 13 = @scoped_enum
|
||||||
| 14 = using_alias // a using name = type style typedef
|
| 14 = @using_alias // a using name = type style typedef
|
||||||
;
|
;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
usertypes(
|
usertypes(
|
||||||
unique int id: @usertype,
|
unique int id: @usertype,
|
||||||
string name: string ref,
|
string name: string ref,
|
||||||
@@ -1162,7 +1179,10 @@ case @funbindexpr.kind of
|
|||||||
| 2 = @adl_call // a call whose target is only found by ADL
|
| 2 = @adl_call // a call whose target is only found by ADL
|
||||||
;
|
;
|
||||||
*/
|
*/
|
||||||
iscall(unique int caller: @funbindexpr ref, int kind: int ref);
|
iscall(
|
||||||
|
unique int caller: @funbindexpr ref,
|
||||||
|
int kind: int ref
|
||||||
|
);
|
||||||
|
|
||||||
numtemplatearguments(
|
numtemplatearguments(
|
||||||
unique int expr_id: @expr ref,
|
unique int expr_id: @expr ref,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Uncomment case splits in dbscheme
|
||||||
|
compatibility: full
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
description: Introduce (_Complex) _Float16 type
|
||||||
|
compatibility: full
|
||||||
@@ -44,14 +44,11 @@ predicate eraDate(int year, int month, int day) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
predicate badStructInitialization(Element target, string message) {
|
predicate badStructInitialization(Element target, string message) {
|
||||||
exists(
|
exists(StructLikeClass s, YearFieldAccess year, int yearValue, int monthValue, int dayValue |
|
||||||
StructLikeClass s, YearFieldAccess year, MonthFieldAccess month, DayFieldAccess day,
|
|
||||||
int yearValue, int monthValue, int dayValue
|
|
||||||
|
|
|
||||||
eraDate(yearValue, monthValue, dayValue) and
|
eraDate(yearValue, monthValue, dayValue) and
|
||||||
assignedYear(s, year, yearValue) and
|
assignedYear(s, year, yearValue) and
|
||||||
assignedMonth(s, month, monthValue) and
|
assignedMonth(s, _, monthValue) and
|
||||||
assignedDay(s, day, dayValue) and
|
assignedDay(s, _, dayValue) and
|
||||||
target = year and
|
target = year and
|
||||||
message = "A time struct that is initialized with exact Japanese calendar era start date."
|
message = "A time struct that is initialized with exact Japanese calendar era start date."
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -129,9 +129,7 @@ predicate literalIsEnumInitializer(Literal literal) {
|
|||||||
exists(EnumConstant ec | ec.getInitializer().getExpr() = literal)
|
exists(EnumConstant ec | ec.getInitializer().getExpr() = literal)
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate literalInArrayInitializer(Literal literal) {
|
predicate literalInArrayInitializer(Literal literal) { arrayInitializerChild(_, literal) }
|
||||||
exists(AggregateLiteral arrayInit | arrayInitializerChild(arrayInit, literal))
|
|
||||||
}
|
|
||||||
|
|
||||||
predicate arrayInitializerChild(AggregateLiteral parent, Expr e) {
|
predicate arrayInitializerChild(AggregateLiteral parent, Expr e) {
|
||||||
e = parent
|
e = parent
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ predicate openDefinition(StackVariable v, ControlFlowNode def) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
predicate openReaches(ControlFlowNode def, ControlFlowNode node) {
|
predicate openReaches(ControlFlowNode def, ControlFlowNode node) {
|
||||||
exists(StackVariable v | openDefinition(v, def) and node = def.getASuccessor())
|
openDefinition(_, def) and node = def.getASuccessor()
|
||||||
or
|
or
|
||||||
exists(StackVariable v, ControlFlowNode mid |
|
exists(StackVariable v, ControlFlowNode mid |
|
||||||
openDefinition(v, def) and
|
openDefinition(v, def) and
|
||||||
|
|||||||
@@ -20,83 +20,192 @@ import semmle.code.cpp.dataflow.DataFlow
|
|||||||
import semmle.code.cpp.ir.IR
|
import semmle.code.cpp.ir.IR
|
||||||
import semmle.code.cpp.ir.ValueNumbering
|
import semmle.code.cpp.ir.ValueNumbering
|
||||||
|
|
||||||
/** An expression appearing as an output argument to a `scanf`-like call */
|
/**
|
||||||
class ScanfOutput extends Expr {
|
* Holds if `call` is a `scanf`-like function that may write to `output` at index `index`.
|
||||||
ScanfFunctionCall call;
|
*
|
||||||
int varargIndex;
|
* Furthermore, `instr` is the instruction that defines the address of the `index`'th argument
|
||||||
Instruction instr;
|
* of `call`, and `vn` is the value number of `instr.`
|
||||||
ValueNumber valNum;
|
*/
|
||||||
|
predicate isSource(ScanfFunctionCall call, int index, Instruction instr, ValueNumber vn, Expr output) {
|
||||||
ScanfOutput() {
|
output = call.getOutputArgument(index).getFullyConverted() and
|
||||||
this = call.getOutputArgument(varargIndex).getFullyConverted() and
|
instr.getConvertedResultExpression() = output and
|
||||||
instr.getConvertedResultExpression() = this and
|
vn.getAnInstruction() = instr
|
||||||
valueNumber(instr) = valNum
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScanfFunctionCall getCall() { result = call }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the smallest possible `scanf` return value that would indicate
|
* Holds if `instr` is control-flow reachable in 0 or more steps from
|
||||||
* success in writing this output argument.
|
* a call to a `scanf`-like function.
|
||||||
*/
|
*/
|
||||||
int getMinimumGuardConstant() {
|
pragma[nomagic]
|
||||||
result =
|
predicate fwdFlow0(Instruction instr) {
|
||||||
varargIndex + 1 -
|
isSource(_, _, instr, _, _)
|
||||||
count(ScanfFormatLiteral f, int n |
|
or
|
||||||
// Special case: %n writes to an argument without reading any input.
|
exists(Instruction prev |
|
||||||
// It does not increase the count returned by `scanf`.
|
fwdFlow0(prev) and
|
||||||
n <= varargIndex and f.getUse() = call and f.getConversionChar(n) = "n"
|
prev.getASuccessor() = instr
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate hasGuardedAccess(Access e, boolean isGuarded) {
|
/**
|
||||||
e = this.getAnAccess() and
|
* Holds if `instr` is part of the IR translation of `access` that
|
||||||
if
|
* is not an expression being deallocated, and `instr` has value
|
||||||
exists(int value, int minGuard | minGuard = this.getMinimumGuardConstant() |
|
* number `vn`.
|
||||||
|
*/
|
||||||
|
predicate isSink(Instruction instr, Access access, ValueNumber vn) {
|
||||||
|
instr.getAst() = access and
|
||||||
|
not any(DeallocationExpr dealloc).getFreedExpr() = access and
|
||||||
|
vn.getAnInstruction() = instr
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if `instr` is part of a path from a call to a `scanf`-like function
|
||||||
|
* to a use of the written variable.
|
||||||
|
*/
|
||||||
|
pragma[nomagic]
|
||||||
|
predicate revFlow0(Instruction instr) {
|
||||||
|
fwdFlow0(instr) and
|
||||||
|
(
|
||||||
|
isSink(instr, _, _)
|
||||||
|
or
|
||||||
|
exists(Instruction succ | revFlow0(succ) | instr.getASuccessor() = succ)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if `instr` is part of a path from a call to a `scanf`-like function
|
||||||
|
* that writes to a variable with value number `vn`, without passing through
|
||||||
|
* redefinitions of the variable.
|
||||||
|
*/
|
||||||
|
pragma[nomagic]
|
||||||
|
private predicate fwdFlow(Instruction instr, ValueNumber vn) {
|
||||||
|
revFlow0(instr) and
|
||||||
|
(
|
||||||
|
isSource(_, _, instr, vn, _)
|
||||||
|
or
|
||||||
|
exists(Instruction prev |
|
||||||
|
fwdFlow(prev, vn) and
|
||||||
|
prev.getASuccessor() = instr and
|
||||||
|
not isBarrier(instr, vn)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if `instr` is part of a path from a call to a `scanf`-like function
|
||||||
|
* that writes to a variable with value number `vn`, without passing through
|
||||||
|
* redefinitions of the variable.
|
||||||
|
*
|
||||||
|
* Note: This predicate only holds for the `(intr, vn)` pairs that are also
|
||||||
|
* control-flow reachable from an argument to a `scanf`-like function call.
|
||||||
|
*/
|
||||||
|
pragma[nomagic]
|
||||||
|
predicate revFlow(Instruction instr, ValueNumber vn) {
|
||||||
|
fwdFlow(instr, vn) and
|
||||||
|
(
|
||||||
|
isSink(instr, _, vn)
|
||||||
|
or
|
||||||
|
exists(Instruction succ | revFlow(succ, vn) |
|
||||||
|
instr.getASuccessor() = succ and
|
||||||
|
not isBarrier(succ, vn)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A type that bundles together a reachable instruction with the appropriate
|
||||||
|
* value number (i.e., the value number that's transferred from the source
|
||||||
|
* to the sink).
|
||||||
|
*/
|
||||||
|
newtype TNode = MkNode(Instruction instr, ValueNumber vn) { revFlow(instr, vn) }
|
||||||
|
|
||||||
|
class Node extends MkNode {
|
||||||
|
ValueNumber vn;
|
||||||
|
Instruction instr;
|
||||||
|
|
||||||
|
Node() { this = MkNode(instr, vn) }
|
||||||
|
|
||||||
|
final string toString() { result = instr.toString() }
|
||||||
|
|
||||||
|
final Node getASuccessor() { result = MkNode(instr.getASuccessor(), vn) }
|
||||||
|
|
||||||
|
final Location getLocation() { result = instr.getLocation() }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if `instr` is an instruction with value number `vn` that is
|
||||||
|
* used in a store operation, or is overwritten by another call to
|
||||||
|
* a `scanf`-like function.
|
||||||
|
*/
|
||||||
|
private predicate isBarrier(Instruction instr, ValueNumber vn) {
|
||||||
|
// We only need to compute barriers for instructions that we
|
||||||
|
// managed to hit during the initial flow stage.
|
||||||
|
revFlow0(pragma[only_bind_into](instr)) and
|
||||||
|
valueNumber(instr) = vn and
|
||||||
|
exists(Expr e | instr.getAst() = e |
|
||||||
|
instr = any(StoreInstruction s).getDestinationAddress()
|
||||||
|
or
|
||||||
|
isSource(_, _, _, _, [e, e.getParent().(AddressOfExpr)])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Holds if `n1` steps to `n2` in a single step. */
|
||||||
|
predicate isSuccessor(Node n1, Node n2) { n1.getASuccessor() = n2 }
|
||||||
|
|
||||||
|
predicate hasFlow(Node n1, Node n2) = fastTC(isSuccessor/2)(n1, n2)
|
||||||
|
|
||||||
|
Node getNode(Instruction instr, ValueNumber vn) { result = MkNode(instr, vn) }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds if `source` is the `index`'th argument to the `scanf`-like call `call`, and `sink` is
|
||||||
|
* an instruction that is part of the translation of `access` which is a transitive
|
||||||
|
* control-flow successor of `call`.
|
||||||
|
*
|
||||||
|
* Furthermore, `source` and `sink` have identical global value numbers.
|
||||||
|
*/
|
||||||
|
predicate hasFlow(
|
||||||
|
Instruction source, ScanfFunctionCall call, int index, Instruction sink, Access access
|
||||||
|
) {
|
||||||
|
exists(ValueNumber vn |
|
||||||
|
isSource(call, index, source, vn, _) and
|
||||||
|
hasFlow(getNode(source, vn), getNode(sink, vn)) and
|
||||||
|
isSink(sink, access, vn)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the smallest possible `scanf` return value of `call` that would indicate
|
||||||
|
* success in writing the output argument at index `index`.
|
||||||
|
*/
|
||||||
|
int getMinimumGuardConstant(ScanfFunctionCall call, int index) {
|
||||||
|
isSource(call, index, _, _, _) and
|
||||||
|
result =
|
||||||
|
index + 1 -
|
||||||
|
count(ScanfFormatLiteral f, int n |
|
||||||
|
// Special case: %n writes to an argument without reading any input.
|
||||||
|
// It does not increase the count returned by `scanf`.
|
||||||
|
n <= index and f.getUse() = call and f.getConversionChar(n) = "n"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds the access to `e` isn't guarded by a check that ensures that `call` returned
|
||||||
|
* at least `minGuard`.
|
||||||
|
*/
|
||||||
|
predicate hasNonGuardedAccess(ScanfFunctionCall call, Access e, int minGuard) {
|
||||||
|
exists(int index |
|
||||||
|
hasFlow(_, call, index, _, e) and
|
||||||
|
minGuard = getMinimumGuardConstant(call, index)
|
||||||
|
|
|
||||||
|
not exists(int value |
|
||||||
e.getBasicBlock() = blockGuardedBy(value, "==", call) and minGuard <= value
|
e.getBasicBlock() = blockGuardedBy(value, "==", call) and minGuard <= value
|
||||||
or
|
or
|
||||||
e.getBasicBlock() = blockGuardedBy(value, "<", call) and minGuard - 1 <= value
|
e.getBasicBlock() = blockGuardedBy(value, "<", call) and minGuard - 1 <= value
|
||||||
or
|
or
|
||||||
e.getBasicBlock() = blockGuardedBy(value, "<=", call) and minGuard <= value
|
e.getBasicBlock() = blockGuardedBy(value, "<=", call) and minGuard <= value
|
||||||
)
|
)
|
||||||
then isGuarded = true
|
|
||||||
else isGuarded = false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a subsequent access of the same underlying storage,
|
|
||||||
* but before it gets reset or reused in another `scanf` call.
|
|
||||||
*/
|
|
||||||
Access getAnAccess() {
|
|
||||||
exists(Instruction dst |
|
|
||||||
this.bigStep() = dst and
|
|
||||||
dst.getAst() = result and
|
|
||||||
valueNumber(dst) = valNum
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private Instruction bigStep() {
|
|
||||||
result = this.smallStep(instr)
|
|
||||||
or
|
|
||||||
exists(Instruction i | i = this.bigStep() | result = this.smallStep(i))
|
|
||||||
}
|
|
||||||
|
|
||||||
private Instruction smallStep(Instruction i) {
|
|
||||||
instr.getASuccessor*() = i and
|
|
||||||
i.getASuccessor() = result and
|
|
||||||
not this.isBarrier(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
private predicate isBarrier(Instruction i) {
|
|
||||||
valueNumber(i) = valNum and
|
|
||||||
exists(Expr e | i.getAst() = e |
|
|
||||||
i = any(StoreInstruction s).getDestinationAddress()
|
|
||||||
or
|
|
||||||
[e, e.getParent().(AddressOfExpr)] instanceof ScanfOutput
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns a block guarded by the assertion of `value op call` */
|
/** Returns a block guarded by the assertion of `value op call` */
|
||||||
BasicBlock blockGuardedBy(int value, string op, ScanfFunctionCall call) {
|
BasicBlock blockGuardedBy(int value, string op, ScanfFunctionCall call) {
|
||||||
exists(GuardCondition g, Expr left, Expr right |
|
exists(GuardCondition g, Expr left, Expr right |
|
||||||
@@ -112,12 +221,9 @@ BasicBlock blockGuardedBy(int value, string op, ScanfFunctionCall call) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
from ScanfOutput output, ScanfFunctionCall call, Access access
|
from ScanfFunctionCall call, Access access, int minGuard
|
||||||
where
|
where hasNonGuardedAccess(call, access, minGuard)
|
||||||
output.getCall() = call and
|
|
||||||
output.hasGuardedAccess(access, false) and
|
|
||||||
not exists(DeallocationExpr dealloc | dealloc.getFreedExpr() = access)
|
|
||||||
select access,
|
select access,
|
||||||
"This variable is read, but may not have been written. " +
|
"This variable is read, but may not have been written. " +
|
||||||
"It should be guarded by a check that the $@ returns at least " +
|
"It should be guarded by a check that the $@ returns at least " + minGuard + ".", call,
|
||||||
output.getMinimumGuardConstant() + ".", call, call.toString()
|
call.toString()
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ predicate freeExprOrIndirect(Expr free, Expr freed, string kind) {
|
|||||||
freeExpr(free, freed, kind)
|
freeExpr(free, freed, kind)
|
||||||
or
|
or
|
||||||
// indirect free via function call
|
// indirect free via function call
|
||||||
exists(Expr internalFree, Expr internalFreed, int arg |
|
exists(Expr internalFreed, int arg |
|
||||||
freeExprOrIndirect(internalFree, internalFreed, kind) and
|
freeExprOrIndirect(_, internalFreed, kind) and
|
||||||
free.(FunctionCall).getTarget().getParameter(arg) = internalFreed.(VariableAccess).getTarget() and
|
free.(FunctionCall).getTarget().getParameter(arg) = internalFreed.(VariableAccess).getTarget() and
|
||||||
free.(FunctionCall).getArgument(arg) = freed
|
free.(FunctionCall).getArgument(arg) = freed
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class CommentBlock extends Comment {
|
|||||||
(
|
(
|
||||||
this instanceof CppStyleComment
|
this instanceof CppStyleComment
|
||||||
implies
|
implies
|
||||||
not exists(CppStyleComment pred, File f | lineInFile(pred, f) + 1 = lineInFile(this, f))
|
not exists(File f | lineInFile(_, f) + 1 = lineInFile(this, f))
|
||||||
) and
|
) and
|
||||||
// Ignore comments on the same line as a preprocessor directive.
|
// Ignore comments on the same line as a preprocessor directive.
|
||||||
not exists(Location l |
|
not exists(Location l |
|
||||||
|
|||||||
@@ -134,8 +134,8 @@ class NonConstFlow extends TaintTracking::Configuration {
|
|||||||
from FormattingFunctionCall call, Expr formatString
|
from FormattingFunctionCall call, Expr formatString
|
||||||
where
|
where
|
||||||
call.getArgument(call.getFormatParameterIndex()) = formatString and
|
call.getArgument(call.getFormatParameterIndex()) = formatString and
|
||||||
exists(NonConstFlow cf, DataFlow::Node source, DataFlow::Node sink |
|
exists(NonConstFlow cf, DataFlow::Node sink |
|
||||||
cf.hasFlow(source, sink) and
|
cf.hasFlowTo(sink) and
|
||||||
sink.asExpr() = formatString
|
sink.asExpr() = formatString
|
||||||
)
|
)
|
||||||
select formatString,
|
select formatString,
|
||||||
|
|||||||
@@ -48,9 +48,7 @@ predicate isOptionSet(ConstructorCall cc, int flag, FunctionCall fcSetOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindingset[flag]
|
bindingset[flag]
|
||||||
predicate isOptionNotSet(ConstructorCall cc, int flag) {
|
predicate isOptionNotSet(ConstructorCall cc, int flag) { not isOptionSet(cc, flag, _) }
|
||||||
not exists(FunctionCall fcSetOptions | isOptionSet(cc, flag, fcSetOptions))
|
|
||||||
}
|
|
||||||
|
|
||||||
from
|
from
|
||||||
BoostorgAsio::SslContextCallTlsProtocolConfig configConstructor, Expr protocolSource,
|
BoostorgAsio::SslContextCallTlsProtocolConfig configConstructor, Expr protocolSource,
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ private newtype LibraryT =
|
|||||||
lib.getVersion() = version
|
lib.getVersion() = version
|
||||||
} or
|
} or
|
||||||
LibraryTExternalPackage(@external_package ep, string name, string version) {
|
LibraryTExternalPackage(@external_package ep, string name, string version) {
|
||||||
exists(string namespace, string package_name |
|
exists(string package_name |
|
||||||
external_packages(ep, namespace, package_name, version) and
|
external_packages(ep, _, package_name, version) and
|
||||||
name = package_name
|
name = package_name
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -42,8 +42,8 @@ class Library extends LibraryT {
|
|||||||
string version;
|
string version;
|
||||||
|
|
||||||
Library() {
|
Library() {
|
||||||
exists(LibraryElement lib | this = LibraryTElement(lib, name, version)) or
|
this = LibraryTElement(_, name, version) or
|
||||||
exists(@external_package ep | this = LibraryTExternalPackage(ep, name, version))
|
this = LibraryTExternalPackage(_, name, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
string getName() { result = name }
|
string getName() { result = name }
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ private PreprocessorDirective next(PreprocessorDirective ppd) {
|
|||||||
|
|
||||||
private int level(PreprocessorDirective ppd) {
|
private int level(PreprocessorDirective ppd) {
|
||||||
relevantDirective(ppd, _, _) and
|
relevantDirective(ppd, _, _) and
|
||||||
not exists(PreprocessorDirective previous | ppd = next(previous)) and
|
not ppd = next(_) and
|
||||||
result = 0
|
result = 0
|
||||||
or
|
or
|
||||||
exists(PreprocessorDirective previous |
|
exists(PreprocessorDirective previous |
|
||||||
@@ -101,8 +101,8 @@ predicate headerGuard(PreprocessorDirective notdef, File f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
predicate headerGuardChild(PreprocessorDirective open) {
|
predicate headerGuardChild(PreprocessorDirective open) {
|
||||||
exists(File f, PreprocessorDirective headerGuard |
|
exists(File f |
|
||||||
headerGuard(headerGuard, f) and
|
headerGuard(_, f) and
|
||||||
openWithDepth(1, f, open, _)
|
openWithDepth(1, f, open, _)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class VarargsFunction extends Function {
|
|||||||
totalCount = this.totalCount() and
|
totalCount = this.totalCount() and
|
||||||
100 * cnt / totalCount >= 80 and
|
100 * cnt / totalCount >= 80 and
|
||||||
// terminator value is not used in a non-terminating position
|
// terminator value is not used in a non-terminating position
|
||||||
not exists(FunctionCall fc, int index | this.nonTrailingVarArgValue(fc, index) = result)
|
not this.nonTrailingVarArgValue(_, _) = result
|
||||||
}
|
}
|
||||||
|
|
||||||
predicate isWhitelisted() { this.hasGlobalName(["open", "fcntl", "ptrace", "mremap"]) }
|
predicate isWhitelisted() { this.hasGlobalName(["open", "fcntl", "ptrace", "mremap"]) }
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import semmle.code.cpp.models.interfaces.ArrayFunction
|
|||||||
import semmle.code.cpp.models.interfaces.Allocation
|
import semmle.code.cpp.models.interfaces.Allocation
|
||||||
import semmle.code.cpp.commons.NullTermination
|
import semmle.code.cpp.commons.NullTermination
|
||||||
|
|
||||||
predicate terminationProblem(AllocationExpr malloc, string msg) {
|
predicate terminationProblem(HeuristicAllocationExpr malloc, string msg) {
|
||||||
// malloc(strlen(...))
|
// malloc(strlen(...))
|
||||||
exists(StrlenCall strlen | DataFlow::localExprFlow(strlen, malloc.getSizeExpr())) and
|
exists(StrlenCall strlen | DataFlow::localExprFlow(strlen, malloc.getSizeExpr())) and
|
||||||
// flows to a call that implies this is a null-terminated string
|
// flows to a call that implies this is a null-terminated string
|
||||||
|
|||||||
@@ -25,9 +25,8 @@ import DataFlow::PathGraph
|
|||||||
* Holds if `alloc` is an allocation, and `tainted` is a child of it that is a
|
* Holds if `alloc` is an allocation, and `tainted` is a child of it that is a
|
||||||
* taint sink.
|
* taint sink.
|
||||||
*/
|
*/
|
||||||
predicate allocSink(Expr alloc, DataFlow::Node sink) {
|
predicate allocSink(HeuristicAllocationExpr alloc, DataFlow::Node sink) {
|
||||||
exists(Expr e | e = sink.asConvertedExpr() |
|
exists(Expr e | e = sink.asConvertedExpr() |
|
||||||
isAllocationExpr(alloc) and
|
|
||||||
e = alloc.getAChild() and
|
e = alloc.getAChild() and
|
||||||
e.getUnspecifiedType() instanceof IntegralType
|
e.getUnspecifiedType() instanceof IntegralType
|
||||||
)
|
)
|
||||||
@@ -89,6 +88,10 @@ class TaintedAllocationSizeConfiguration extends TaintTracking::Configuration {
|
|||||||
readsVariable(access.getDef(), checkedVar) and
|
readsVariable(access.getDef(), checkedVar) and
|
||||||
nodeIsBarrierEqualityCandidate(node, access, checkedVar)
|
nodeIsBarrierEqualityCandidate(node, access, checkedVar)
|
||||||
)
|
)
|
||||||
|
or
|
||||||
|
// block flow to inside of identified allocation functions (this flow leads
|
||||||
|
// to duplicate results)
|
||||||
|
any(HeuristicAllocationFunction f).getAParameter() = node.asParameter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,76 +15,24 @@
|
|||||||
import semmle.code.cpp.ir.dataflow.internal.DefaultTaintTrackingImpl
|
import semmle.code.cpp.ir.dataflow.internal.DefaultTaintTrackingImpl
|
||||||
import TaintedWithPath
|
import TaintedWithPath
|
||||||
|
|
||||||
|
string getATopLevelDomain() {
|
||||||
|
result =
|
||||||
|
[
|
||||||
|
"com", "ru", "net", "org", "de", "jp", "uk", "br", "pl", "in", "it", "fr", "au", "info", "nl",
|
||||||
|
"cn", "ir", "es", "cz", "biz", "ca", "eu", "ua", "kr", "za", "co", "gr", "ro", "se", "tw",
|
||||||
|
"vn", "mx", "ch", "tr", "at", "be", "hu", "tv", "dk", "me", "ar", "us", "no", "sk", "fi",
|
||||||
|
"id", "cl", "nz", "by", "xyz", "pt", "ie", "il", "kz", "my", "hk", "lt", "cc", "sg", "io",
|
||||||
|
"edu", "gov"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
predicate hardCodedAddressOrIP(StringLiteral txt) {
|
predicate hardCodedAddressOrIP(StringLiteral txt) {
|
||||||
exists(string s | s = txt.getValueText() |
|
exists(string s | s = txt.getValueText() |
|
||||||
// Hard-coded ip addresses, such as 127.0.0.1
|
// Hard-coded ip addresses, such as 127.0.0.1
|
||||||
s.regexpMatch("\"[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+\"") or
|
s.regexpMatch("\"[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+\"") or
|
||||||
// Hard-coded addresses such as www.mycompany.com
|
// Hard-coded addresses such as www.mycompany.com
|
||||||
s.matches("\"www.%\"") or
|
s.regexpMatch("\"(www\\.|http:|https:).*\"") or
|
||||||
s.matches("\"http:%\"") or
|
s.regexpMatch("\".*\\.(" + strictconcat(getATopLevelDomain(), "|") + ")\"")
|
||||||
s.matches("\"https:%\"") or
|
|
||||||
s.matches("\"%.com\"") or
|
|
||||||
s.matches("\"%.ru\"") or
|
|
||||||
s.matches("\"%.net\"") or
|
|
||||||
s.matches("\"%.org\"") or
|
|
||||||
s.matches("\"%.de\"") or
|
|
||||||
s.matches("\"%.jp\"") or
|
|
||||||
s.matches("\"%.uk\"") or
|
|
||||||
s.matches("\"%.br\"") or
|
|
||||||
s.matches("\"%.pl\"") or
|
|
||||||
s.matches("\"%.in\"") or
|
|
||||||
s.matches("\"%.it\"") or
|
|
||||||
s.matches("\"%.fr\"") or
|
|
||||||
s.matches("\"%.au\"") or
|
|
||||||
s.matches("\"%.info\"") or
|
|
||||||
s.matches("\"%.nl\"") or
|
|
||||||
s.matches("\"%.cn\"") or
|
|
||||||
s.matches("\"%.ir\"") or
|
|
||||||
s.matches("\"%.es\"") or
|
|
||||||
s.matches("\"%.cz\"") or
|
|
||||||
s.matches("\"%.biz\"") or
|
|
||||||
s.matches("\"%.ca\"") or
|
|
||||||
s.matches("\"%.eu\"") or
|
|
||||||
s.matches("\"%.ua\"") or
|
|
||||||
s.matches("\"%.kr\"") or
|
|
||||||
s.matches("\"%.za\"") or
|
|
||||||
s.matches("\"%.co\"") or
|
|
||||||
s.matches("\"%.gr\"") or
|
|
||||||
s.matches("\"%.ro\"") or
|
|
||||||
s.matches("\"%.se\"") or
|
|
||||||
s.matches("\"%.tw\"") or
|
|
||||||
s.matches("\"%.vn\"") or
|
|
||||||
s.matches("\"%.mx\"") or
|
|
||||||
s.matches("\"%.ch\"") or
|
|
||||||
s.matches("\"%.tr\"") or
|
|
||||||
s.matches("\"%.at\"") or
|
|
||||||
s.matches("\"%.be\"") or
|
|
||||||
s.matches("\"%.hu\"") or
|
|
||||||
s.matches("\"%.tv\"") or
|
|
||||||
s.matches("\"%.dk\"") or
|
|
||||||
s.matches("\"%.me\"") or
|
|
||||||
s.matches("\"%.ar\"") or
|
|
||||||
s.matches("\"%.us\"") or
|
|
||||||
s.matches("\"%.no\"") or
|
|
||||||
s.matches("\"%.sk\"") or
|
|
||||||
s.matches("\"%.fi\"") or
|
|
||||||
s.matches("\"%.id\"") or
|
|
||||||
s.matches("\"%.cl\"") or
|
|
||||||
s.matches("\"%.nz\"") or
|
|
||||||
s.matches("\"%.by\"") or
|
|
||||||
s.matches("\"%.xyz\"") or
|
|
||||||
s.matches("\"%.pt\"") or
|
|
||||||
s.matches("\"%.ie\"") or
|
|
||||||
s.matches("\"%.il\"") or
|
|
||||||
s.matches("\"%.kz\"") or
|
|
||||||
s.matches("\"%.my\"") or
|
|
||||||
s.matches("\"%.hk\"") or
|
|
||||||
s.matches("\"%.lt\"") or
|
|
||||||
s.matches("\"%.cc\"") or
|
|
||||||
s.matches("\"%.sg\"") or
|
|
||||||
s.matches("\"%.io\"") or
|
|
||||||
s.matches("\"%.edu\"") or
|
|
||||||
s.matches("\"%.gov\"")
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ predicate filenameOperation(FunctionCall op, Expr path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
predicate isFileName(GVN gvn) {
|
predicate isFileName(GVN gvn) {
|
||||||
exists(FunctionCall op, Expr path |
|
exists(Expr path |
|
||||||
filenameOperation(op, path) and
|
filenameOperation(_, path) and
|
||||||
gvn = globalValueNumber(path)
|
gvn = globalValueNumber(path)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,8 +106,8 @@ predicate checksPath(Expr check, Expr checkPath) {
|
|||||||
// access to a member variable on the stat buf
|
// access to a member variable on the stat buf
|
||||||
// (morally, this should be a use-use pair, but it seems unlikely
|
// (morally, this should be a use-use pair, but it seems unlikely
|
||||||
// that this variable will get reused in practice)
|
// that this variable will get reused in practice)
|
||||||
exists(Expr call, Expr e, Variable v |
|
exists(Expr e, Variable v |
|
||||||
statCallWithPointer(checkPath, call, e, v) and
|
statCallWithPointer(checkPath, _, e, v) and
|
||||||
check.(VariableAccess).getTarget() = v and
|
check.(VariableAccess).getTarget() = v and
|
||||||
not e.getAChild*() = check // the call that writes to the pointer is not where the pointer is checked.
|
not e.getAChild*() = check // the call that writes to the pointer is not where the pointer is checked.
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -100,14 +100,14 @@ predicate isQuotedOrNoSpaceApplicationNameOnCmd(string s) {
|
|||||||
|
|
||||||
from CreateProcessFunctionCall call, string msg1, string msg2
|
from CreateProcessFunctionCall call, string msg1, string msg2
|
||||||
where
|
where
|
||||||
exists(Expr source, Expr appName, NullAppNameCreateProcessFunctionConfiguration nullAppConfig |
|
exists(Expr appName, NullAppNameCreateProcessFunctionConfiguration nullAppConfig |
|
||||||
appName = call.getArgument(call.getApplicationNameArgumentId()) and
|
appName = call.getArgument(call.getApplicationNameArgumentId()) and
|
||||||
nullAppConfig.hasFlow(DataFlow2::exprNode(source), DataFlow2::exprNode(appName)) and
|
nullAppConfig.hasFlowToExpr(appName) and
|
||||||
msg1 = call.toString() + " with lpApplicationName == NULL (" + appName + ")"
|
msg1 = call.toString() + " with lpApplicationName == NULL (" + appName + ")"
|
||||||
) and
|
) and
|
||||||
exists(Expr source, Expr cmd, QuotedCommandInCreateProcessFunctionConfiguration quotedConfig |
|
exists(Expr cmd, QuotedCommandInCreateProcessFunctionConfiguration quotedConfig |
|
||||||
cmd = call.getArgument(call.getCommandLineArgumentId()) and
|
cmd = call.getArgument(call.getCommandLineArgumentId()) and
|
||||||
quotedConfig.hasFlow(DataFlow2::exprNode(source), DataFlow2::exprNode(cmd)) and
|
quotedConfig.hasFlowToExpr(cmd) and
|
||||||
msg2 =
|
msg2 =
|
||||||
" and with an unquoted lpCommandLine (" + cmd +
|
" and with an unquoted lpCommandLine (" + cmd +
|
||||||
") introduces a security vulnerability if the path contains spaces."
|
") introduces a security vulnerability if the path contains spaces."
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ Type baseType(Type t) {
|
|||||||
*/
|
*/
|
||||||
predicate exprSourceType(Expr use, Type sourceType, Location sourceLoc) {
|
predicate exprSourceType(Expr use, Type sourceType, Location sourceLoc) {
|
||||||
// Reaching definitions.
|
// Reaching definitions.
|
||||||
if exists(SsaDefinition def, StackVariable v | use = def.getAUse(v))
|
if exists(SsaDefinition def | use = def.getAUse(_))
|
||||||
then
|
then
|
||||||
exists(SsaDefinition def, StackVariable v | use = def.getAUse(v) |
|
exists(SsaDefinition def, StackVariable v | use = def.getAUse(v) |
|
||||||
defSourceType(def, v, sourceType, sourceLoc)
|
defSourceType(def, v, sourceType, sourceLoc)
|
||||||
|
|||||||
@@ -83,16 +83,13 @@ where
|
|||||||
call.getArgument(2) = nullExpr
|
call.getArgument(2) = nullExpr
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
exists(
|
exists(VariableAccess var, NullDaclConfig nullDaclConfig, NonNullDaclConfig nonNullDaclConfig |
|
||||||
Expr constassign, VariableAccess var, NullDaclConfig nullDaclConfig,
|
|
||||||
NonNullDaclConfig nonNullDaclConfig
|
|
||||||
|
|
|
||||||
message =
|
message =
|
||||||
"Setting a DACL to NULL in a SECURITY_DESCRIPTOR using variable " + var +
|
"Setting a DACL to NULL in a SECURITY_DESCRIPTOR using variable " + var +
|
||||||
" that is set to NULL will result in an unprotected object."
|
" that is set to NULL will result in an unprotected object."
|
||||||
|
|
|
|
||||||
var = call.getArgument(2) and
|
var = call.getArgument(2) and
|
||||||
nullDaclConfig.hasFlow(DataFlow::exprNode(constassign), DataFlow::exprNode(var)) and
|
nullDaclConfig.hasFlowToExpr(var) and
|
||||||
not nonNullDaclConfig.hasFlow(_, DataFlow::exprNode(var))
|
not nonNullDaclConfig.hasFlowToExpr(var)
|
||||||
)
|
)
|
||||||
select call, message
|
select call, message
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
category: minorAnalysis
|
||||||
|
---
|
||||||
|
* The `cpp/no-space-for-terminator` and `cpp/uncontrolled-allocation-size` queries have been enhanced with heuristic detection of allocations. These queries now find more results.
|
||||||
9
cpp/ql/src/codeql-suites/cpp-security-experimental.qls
Normal file
9
cpp/ql/src/codeql-suites/cpp-security-experimental.qls
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
- description: Extended and experimental security queries for C and C++
|
||||||
|
- queries: .
|
||||||
|
- apply: security-experimental-selectors.yml
|
||||||
|
from: codeql/suite-helpers
|
||||||
|
- apply: codeql-suites/exclude-slow-queries.yml
|
||||||
|
# Excluding problematically slow experimental queries
|
||||||
|
- exclude:
|
||||||
|
query path:
|
||||||
|
- experimental/Security/CWE/CWE-266/IncorrectPrivilegeAssignment.ql
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
* @id cpp/off-by-one-array-access
|
* @id cpp/off-by-one-array-access
|
||||||
* @tags reliability
|
* @tags reliability
|
||||||
* security
|
* security
|
||||||
|
* experimental
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import cpp
|
import cpp
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
* @id cpp/overrun-write
|
* @id cpp/overrun-write
|
||||||
* @tags reliability
|
* @tags reliability
|
||||||
* security
|
* security
|
||||||
|
* experimental
|
||||||
* external/cwe/cwe-119
|
* external/cwe/cwe-119
|
||||||
* external/cwe/cwe-131
|
* external/cwe/cwe-131
|
||||||
*/
|
*/
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user