Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main #58

Open
wants to merge 203 commits into
base: main
Choose a base branch
from
Open

Main #58

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
6739750
Add Unsafe Unpacking Query (CWE-022)
maikypedia Nov 23, 2023
96f8a02
JS: Treat private-field methods as private
asgerf Jan 15, 2024
00d1f8e
Merge branch 'main' into maikypedia/swift-zip
ghsecuritylab Jan 25, 2024
ddbacc3
Shared: add test case for stateful outBarrier bug
asgerf Jan 26, 2024
d1310c7
Shared: remove old stateful outBarrier check
asgerf Jan 25, 2024
f15ead6
Shared: check stateful outBarrier as part of pathStep SCC
asgerf Jan 25, 2024
ee8e9a4
Shared: update test output
asgerf Jan 26, 2024
19cb7ad
Migrate path injection sinks to MaD
atorralba Apr 20, 2023
1d2a51c
Rename change note
atorralba Jan 26, 2024
2a14640
Adjust tests
atorralba Jan 26, 2024
19a6b78
Remove reference to PathCreation
atorralba Jan 26, 2024
b8cb514
Rename the other change note
atorralba Jan 26, 2024
6e550d2
Update more test expectations
atorralba Jan 26, 2024
d8fe0f5
Java: Document which assignment type is covered by which class
Marcono1234 Jan 28, 2024
3f0dc2b
Python: Model the `psycopg` package
RasmusWL Jan 29, 2024
5867fb3
Python: Add change-note
RasmusWL Jan 29, 2024
e441dd4
JS: Expose hasBothNamedAndDefaultExports()
asgerf Jan 16, 2024
0e0fb0e
JS: Remove API graph edge causing ambiguity
asgerf Jan 16, 2024
2d8d11f
JS: Restrict type-only exports in API graphs
asgerf Jan 17, 2024
8930ce7
JS: Do not view packages as nested in a private package
asgerf Jan 16, 2024
6cfdd7a
JS: Add InlineExpectationsTest
asgerf Jan 15, 2024
e2bf9ea
Consider File.exists() et al a path-injection sink
atorralba Jan 30, 2024
1737ba1
JS: Add library for naming endpoints
asgerf Jan 15, 2024
19ba9fe
Handle externs
asgerf Jan 30, 2024
8bd7990
Implement local auth query
joefarebrother Jan 30, 2024
ad8038b
Update MaD Declarations after Triage
Jan 31, 2024
6c6f402
Merge branch 'main' into java/update-mad-decls-after-triage-2024-01-3…
max-schaefer Jan 31, 2024
ab6cea1
Fix missing quotes.
Jan 31, 2024
aa5cccd
JS: Make sinkHasPrimaryName public
asgerf Jan 31, 2024
817d04c
C#: Add more delegate flow tests
hvitved Jan 30, 2024
bfe4a4b
C#: Additional tracking of lambdas through fields and properties
hvitved Jan 31, 2024
9098428
Add security severity
joefarebrother Feb 1, 2024
5d1edd4
Add unit tests
joefarebrother Feb 1, 2024
88c2ccb
Generate stubs
joefarebrother Feb 1, 2024
8a2485a
JS: Address some comments
asgerf Feb 1, 2024
2a00375
Add documentation
joefarebrother Feb 2, 2024
514a92d
Tree-sitter extractors: use fresh IDs for locations
nickrolfe Nov 1, 2023
7185286
Add case for androidx.biometric api
joefarebrother Feb 2, 2024
5022adb
Fixes to qhelp example
joefarebrother Feb 2, 2024
596f48c
Add change note
joefarebrother Feb 2, 2024
b8dc633
add cs/path-injection as markdown to make nicer diffs
erik-krogh Feb 5, 2024
9dfac3a
move qhelp samples to an `examples` folder
erik-krogh Feb 5, 2024
8160291
copy (and adjust) the path-injection QHelp from Java to C#
erik-krogh Feb 5, 2024
a240618
generate the new rendered markdown
erik-krogh Feb 5, 2024
a6b094c
delete the rendered markdown again
erik-krogh Feb 5, 2024
f792b58
Ruby: Recognise more ActiveRecord connections
hmac Feb 5, 2024
44fe34a
use the correct string type in the tainted-path examples
erik-krogh Feb 6, 2024
4e17623
add a definition of user
erik-krogh Feb 6, 2024
94b7bda
exclude tagged template literals from `js/superfluous-trailing-argume…
erik-krogh Feb 6, 2024
705a377
Address review comments.
Feb 5, 2024
1484a16
Reduce severity of `java/relative-path-command`
JLLeitschuh Feb 6, 2024
082754a
Remove problematic Kotlin model.
Feb 7, 2024
9ce75da
Update UnsafeUnpackQuery.qll
maikypedia Feb 7, 2024
c6fb303
Suggested changes
maikypedia Feb 7, 2024
7fb72ea
Redundant import
maikypedia Feb 7, 2024
7c0f80f
Apply suggestions from code review
maikypedia Feb 7, 2024
1a499cf
Update `expected`
maikypedia Feb 7, 2024
ed052cc
Change note
maikypedia Feb 7, 2024
1c7e6e7
C#: Try resolve relative paths in line mappings
tamasvajk Feb 7, 2024
62bd3ac
Merge branch 'main' into maikypedia/swift-zip
maikypedia Feb 8, 2024
ed030bc
Merge branch 'main' into maikypedia/swift-zip
maikypedia Feb 8, 2024
f50dab3
Kotlin 2: Accept loc changes in library-tests/interface-delegate
igfoo Feb 8, 2024
78ce857
C++: Add consistency test and accept consistency failures.
MathiasVP Feb 8, 2024
4d01a93
C++: Use 'getUnderlyingType' instead of 'getUnspecifiedType'.
MathiasVP Feb 8, 2024
1dfddaf
C++: Also mark indirections of glvalue instructions as glvalue nodes.
MathiasVP Feb 8, 2024
f7d1544
C++: Fix Code Scanning errors.
MathiasVP Feb 8, 2024
2852f09
Kotlin: Accept test changes in library-tests/java-kotlin-collection-t…
igfoo Feb 8, 2024
34f7486
Java: Add extension point and default sanitizer to Open Redirect query
atorralba Feb 9, 2024
fb10967
Address more review feedback.
Feb 9, 2024
48890b4
Ruby: Add more actioncontroller tests
hmac Feb 9, 2024
d46028f
Merge pull request #15542 from tamasvajk/feature/relative-line-pragma
tamasvajk Feb 9, 2024
3a90d78
Ruby: Fix Rails view file regex
hmac Feb 8, 2024
4c0d535
Merge pull request #12886 from atorralba/atorralba/java/path-injectio…
atorralba Feb 9, 2024
f4b6a85
Fix typo in qldoc
joefarebrother Feb 9, 2024
b7d4a69
Dataflow: Add empty provenance column to PathGraph.
aschackmull Feb 8, 2024
dd3d701
C++: Undo a change that wasn't actually necessary.
MathiasVP Feb 9, 2024
e9e445b
Java: Add empty provenance column to expected files.
aschackmull Feb 2, 2024
21a6520
C#: Add empty provenance column to expected files.
aschackmull Feb 5, 2024
3b8af1e
Go: Add empty provenance column to expected files.
aschackmull Feb 6, 2024
228a61e
Swift: Add empty provenance column to expected files.
aschackmull Feb 6, 2024
35a3aa0
Ruby: Add empty provenance column to expected files.
aschackmull Feb 7, 2024
7eb5e18
C++: Add empty provenance column to expected files.
aschackmull Feb 8, 2024
0eaf117
Kotlin: Add empty provenance column to expected files.
aschackmull Feb 8, 2024
817aa76
Python: Remove redundant IncludePostUpdateFlow and PhaseDependentFlow…
aschackmull Feb 8, 2024
088a0a5
Python: Add empty provenance column to expected files.
aschackmull Feb 8, 2024
4fcb902
Dataflow: Add change note.
aschackmull Feb 8, 2024
a42c845
Merge pull request #15559 from MathiasVP/fix-constness-type
MathiasVP Feb 9, 2024
93990ec
Merge pull request #15486 from github/java/update-mad-decls-after-tri…
max-schaefer Feb 9, 2024
9785ce4
C#: Actually cache module `Cached`
hvitved Feb 9, 2024
1b91695
Kotlin 2: Accept some location changes in library-tests/methods
igfoo Feb 9, 2024
566351a
Merge pull request #15549 from aschackmull/dataflow/empty-provenance
aschackmull Feb 9, 2024
b836260
Kotlin 2: Accept some test changes
igfoo Feb 9, 2024
be4413f
Kotlin 2: Accept changes in library-tests/methods/parameters.expected
igfoo Feb 9, 2024
0547c87
Kotlin 2: Accept some location changes in library-tests/methods/exprs…
igfoo Feb 9, 2024
0c43ad4
Ruby: Add another captured variable data flow test
hvitved Feb 7, 2024
1ea7717
Capture flow: Take overwrites in nested scopes into account
hvitved Feb 7, 2024
37d7741
Ruby: Fix SSA inconsistency
hvitved Feb 7, 2024
ab758d5
Kotlin 2: Accept loc changes in library-tests/parameter-defaults/defa…
igfoo Feb 9, 2024
16aed18
Address reviews - Elaborate on docs and update severity
joefarebrother Feb 9, 2024
e75f7dd
Merge pull request #15540 from hvitved/variable-capture-overwrite
hvitved Feb 10, 2024
3cba176
Add changed framework coverage reports
github-actions[bot] Feb 12, 2024
3212f80
Bump chrono from 0.4.33 to 0.4.34 in /ql
dependabot[bot] Feb 12, 2024
4d65e4e
Merge pull request #15579 from github/dependabot/cargo/ql/chrono-0.4.34
erik-krogh Feb 12, 2024
9634511
Merge pull request #15489 from hvitved/csharp/lambda-field-flow
hvitved Feb 12, 2024
b27b89b
Merge pull request #15567 from hvitved/csharp/cache-module
hvitved Feb 12, 2024
5f729d5
Merge pull request #15578 from github/workflow/coverage/update
atorralba Feb 12, 2024
e6623eb
Add change note
atorralba Feb 12, 2024
cf7091a
Merge branch 'main' into atorralba/java/open-redirect-sanitizer
atorralba Feb 12, 2024
933a8e6
Add integration test for missing nuget package sources
tamasvajk Feb 12, 2024
26cea33
C# - Add default nuget feed if there's none
tamasvajk Feb 9, 2024
5be3993
Preserve nuget.config file casing after cleanup
tamasvajk Feb 12, 2024
b2ee580
Merge pull request #15496 from github/nickrolfe/loc-fresh-ids
nickrolfe Feb 12, 2024
6779c66
Limit xl runner jobs to github org
jsoref Feb 12, 2024
d3fea40
Apply suggestions from documentation review
joefarebrother Feb 12, 2024
1520305
Merge pull request #15523 from erik-krogh/exclude-tagged
erik-krogh Feb 12, 2024
6d01ba6
JS: Check isPrivateLike in isExported instead
asgerf Feb 12, 2024
0fbe530
JS: Fix some broken comments
asgerf Feb 12, 2024
8d3a19a
JS: Fix termination criteria
asgerf Feb 12, 2024
70b6ae6
Add comments to nuget.config file restore
tamasvajk Feb 12, 2024
888f47c
Remove `cil=false` extractor option from integration tests
tamasvajk Feb 12, 2024
afe3c5e
C#: Re-arrange the code in constructor data flow test and update expe…
michaelnebel Feb 2, 2024
86212b2
C#: Move constructor data flow tests to a separate folder.
michaelnebel Feb 2, 2024
f5d4c49
C#: Add some more constructor dataflow tests.
michaelnebel Feb 2, 2024
42f4656
C#: Data flow for primary constructors.
michaelnebel Feb 8, 2024
ff29679
C#: Update expected test output.
michaelnebel Feb 9, 2024
4083348
C#: Add a primary constructor QL library test.
michaelnebel Jan 30, 2024
aed5080
C#: Add primary constructor change note.
michaelnebel Feb 12, 2024
a7eac11
Merge pull request #15569 from igfoo/igfoo/kt2-accept
igfoo Feb 12, 2024
931b27f
Merge pull request #15573 from igfoo/igfoo/k2-more
igfoo Feb 12, 2024
db2eb20
Merge pull request #15565 from atorralba/atorralba/java/open-redirect…
atorralba Feb 12, 2024
75a2b94
Merge pull request #15481 from joefarebrother/android-local-auth
joefarebrother Feb 12, 2024
b6385f7
Merge pull request #15533 from JLLeitschuh/patch-5
atorralba Feb 12, 2024
99497e5
Merge pull request #15521 from hmac/hmac-ar-connection
hmac Feb 12, 2024
68b920f
C#: Update other tests expected output.
michaelnebel Feb 12, 2024
3d9f9af
Merge pull request #15566 from hmac/hmac-actioncontroller-regex
hmac Feb 12, 2024
cbb9a64
Merge pull request #15457 from RasmusWL/psycopg
RasmusWL Feb 12, 2024
27ebebc
Python: Update BUILD.bazel files.
criemen Feb 12, 2024
8635b5d
C++: Add test with missing flow.
MathiasVP Feb 12, 2024
70c7c1a
C++: Add flow from the fill character to the output pointer.
MathiasVP Feb 12, 2024
a799399
C++: Accept test changes.
MathiasVP Feb 12, 2024
faefa05
Merge pull request #15507 from asgerf/shared/outbarrier-bugfix
asgerf Feb 12, 2024
a128161
Use `!cancelled` in qhelp-pr-preview workflow
jsoref Feb 12, 2024
a300808
Bump the extractor-dependencies group in /go/extractor with 1 update
dependabot[bot] Feb 13, 2024
de13ff6
Merge pull request #15577 from tamasvajk/feature/missing-nuget-sources
tamasvajk Feb 13, 2024
baa3c35
JS: Refactor aliasing relation
asgerf Feb 13, 2024
543e183
JS: Describe 1-step aliasing rule
asgerf Feb 13, 2024
6598a66
JS: Use set literal
asgerf Feb 13, 2024
062f16e
Merge pull request #15519 from erik-krogh/cs-path
erik-krogh Feb 13, 2024
b509645
C++: Bump language version in IR tests to C++20
jketema Feb 13, 2024
e08946e
Merge pull request #15586 from github/criemen/bazel-python-language-pack
criemen Feb 13, 2024
4e11676
Merge pull request #15589 from jsoref/avoid-always
smowton Feb 13, 2024
8aeb756
C++: Add constructor and destructor for `vector` to IR test
jketema Feb 13, 2024
fb072a5
C++: Add additional IR tests for init statements
jketema Feb 13, 2024
565f8e8
Merge pull request #15594 from jketema/destructors
jketema Feb 13, 2024
69c0f0c
C#: Address review comments.
michaelnebel Feb 13, 2024
eaf129d
C#: Update expected test output.
michaelnebel Feb 13, 2024
048b372
Merge pull request #15587 from MathiasVP/fix-memset-model
MathiasVP Feb 13, 2024
8efe349
C#: Add indirect assignment example.
michaelnebel Feb 13, 2024
91bbbe2
C#: Address more review comments.
michaelnebel Feb 13, 2024
f3e55a4
C++: Update test results of `constexpr if` destructors
jketema Feb 13, 2024
ebd6853
C#: Avoid overlapping output in data flow test
hvitved Feb 13, 2024
3f43f45
C#: Assume captured variables are live at exit in SSA construction
hvitved Feb 13, 2024
7bdc2c5
C#: Simplify `primaryConstructorParameterStore`
hvitved Feb 13, 2024
7c59c7b
C#: Update QLdoc
hvitved Feb 13, 2024
bc8761c
Data flow: Cache `viableCallableExt`
hvitved Feb 12, 2024
cb7fe16
Revert "Merge pull request #15537 from MathiasVP/swap-also-clears-fir…
MathiasVP Feb 9, 2024
fb4bd53
Revert "Merge pull request #15528 from MathiasVP/flow-barrier-interface"
MathiasVP Feb 9, 2024
7122a75
JS: Fix flow through &&
asgerf Feb 13, 2024
ac001c3
Merge pull request #15561 from igfoo/igfoo/kt2-tests
igfoo Feb 13, 2024
7a7e033
Merge pull request #15601 from MathiasVP/revert-new-barrier-interface
MathiasVP Feb 13, 2024
5e08bf0
Go: Add missing call to `extractFileInfo`
mbg Feb 13, 2024
be52150
Go: Do not add dummy files to `CompilationCompilingFilesTable`
mbg Feb 13, 2024
7217dfa
Merge pull request #15590 from github/dependabot/go_modules/go/extrac…
smowton Feb 13, 2024
fd1314b
Merge pull request #14888 from maikypedia/maikypedia/swift-zip
geoffw0 Feb 13, 2024
f27fda8
Update tests.expected
asgerf Feb 13, 2024
f5c4376
Update UselessConditional.expected
asgerf Feb 13, 2024
42e708b
Swift: Tweak the change note.
geoffw0 Feb 13, 2024
dfba6b9
Swift: Case consistency.
geoffw0 Feb 13, 2024
c6f4495
Go: Exclude dummy files from `File`
mbg Feb 13, 2024
205847d
Go: Add `DummyFile` class
mbg Feb 13, 2024
65e3ae0
Swift: Move the two CWE-022 tests into a common directory.
geoffw0 Feb 13, 2024
159080f
Swift: Accept test changes.
geoffw0 Feb 13, 2024
b776cbe
Merge pull request #15597 from jketema/destructors2
jketema Feb 13, 2024
f7955db
Merge pull request #15603 from github/mbg/go/fix-file-info-extraction
mbg Feb 13, 2024
b3aea0f
C++: Do not print the qualifier of `OverloadedPointerDereferenceExpr`…
jketema Feb 13, 2024
caf09e0
C++: Update IR comment that no longer applies
jketema Feb 13, 2024
a3b3aa4
C++: Update tests after extractor changes
jketema Feb 13, 2024
0d6c141
Merge pull request #15607 from geoffw0/unsafeunpack
geoffw0 Feb 13, 2024
c79cc49
C++: Accept more test changes
jketema Feb 13, 2024
9a08c27
JS: Change note
asgerf Feb 13, 2024
fb2d36d
Merge pull request #15451 from Marcono1234/marcono1234/java-assignmen…
aschackmull Feb 14, 2024
bafea91
Merge pull request #15474 from michaelnebel/csharp/primaryconstructors
michaelnebel Feb 14, 2024
96ed659
Merge branch 'main' into github-only
oscarsj Feb 14, 2024
393251d
Merge pull request #15582 from hvitved/dataflow/cache-viable-callable…
aschackmull Feb 14, 2024
bafe5e3
JS: Add test case (with old expected data)
asgerf Feb 14, 2024
18db769
JS: Update expected output
asgerf Feb 14, 2024
2172c48
Merge pull request #15380 from asgerf/js/endpoint-naming
asgerf Feb 14, 2024
337db6b
Merge pull request #15609 from jketema/destructors3
jketema Feb 14, 2024
75a95ff
Merge pull request #15602 from asgerf/js/block-logical-and-flow
asgerf Feb 14, 2024
cd00a4d
Merge pull request #15584 from jsoref/github-only
oscarsj Feb 14, 2024
1b40b59
Kotlin: Handle forAllMethodsWithBody being removed
igfoo Feb 13, 2024
48ea94b
Kotlin: Handle PsiSourceManager moving
igfoo Feb 13, 2024
c87b7b5
Merge pull request #15606 from igfoo/igfoo/kt2
igfoo Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/workflows/compile-queries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

jobs:
compile-queries:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/csharp-qltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
xargs codeql execute upgrades testdb
diff -q testdb/semmlecode.csharp.dbscheme downgrades/initial/semmlecode.csharp.dbscheme
qltest:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
strategy:
fail-fast: false
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/go-tests-other-os.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
make test cache="${{ steps.query-cache.outputs.cache-dir }}"

test-win:
if: github.repository_owner == 'github'
name: Test Windows
runs-on: windows-latest-xl
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/go-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:
GO_VERSION: '~1.21.0'
jobs:
test-linux:
if: github.repository_owner == 'github'
name: Test Linux (Ubuntu)
runs-on: ubuntu-latest-xl
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qhelp-pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
done < "${RUNNER_TEMP}/paths.txt" >> comment_body.txt
exit "${EXIT_CODE}"

- if: always()
- if: ${{ !cancelled() }}
uses: actions/upload-artifact@v3
with:
name: comment
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ql-for-ql-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ env:

jobs:
analyze:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
steps:
### Build the queries ###
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ruby-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
ruby/extractor/target/release/codeql-extractor-ruby.exe
retention-days: 1
compile-queries:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ruby-qltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
xargs codeql execute upgrades testdb
diff -q testdb/ruby.dbscheme downgrades/initial/ruby.dbscheme
qltest:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
strategy:
fail-fast: false
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,36 +37,40 @@ jobs:
# not using a matrix as you cannot depend on a specific job in a matrix, and we want to start linux checks
# without waiting for the macOS build
build-and-test-macos:
if: github.repository_owner == 'github'
runs-on: macos-12-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
build-and-test-linux:
if: github.repository_owner == 'github'
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/build-and-test
qltests-linux:
if: github.repository_owner == 'github'
needs: build-and-test-linux
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests
qltests-macos:
if : ${{ github.event_name == 'pull_request' }}
if: ${{ github.repository_owner == 'github' && github.event_name == 'pull_request' }}
needs: build-and-test-macos
runs-on: macos-12-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-ql-tests
integration-tests-linux:
if: github.repository_owner == 'github'
needs: build-and-test-linux
runs-on: ubuntu-latest-xl
steps:
- uses: actions/checkout@v4
- uses: ./swift/actions/run-integration-tests
integration-tests-macos:
if : ${{ github.event_name == 'pull_request' }}
if: ${{ github.repository_owner == 'github' && github.event_name == 'pull_request' }}
needs: build-and-test-macos
runs-on: macos-12-xl
timeout-minutes: 60
Expand Down

This file was deleted.

6 changes: 5 additions & 1 deletion cpp/ql/lib/semmle/code/cpp/PrintAST.qll
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,11 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
or
expr.(OverloadedArrayExpr).getArrayOffset() = ele and pred = "getArrayOffset()"
or
expr.(OverloadedPointerDereferenceExpr).getExpr() = ele and pred = "getExpr()"
// OverloadedPointerDereferenceExpr::getExpr/0 also considers qualifiers, which are already handled above for all Call classes.
not expr.(OverloadedPointerDereferenceExpr).getQualifier() =
expr.(OverloadedPointerDereferenceExpr).getExpr() and
expr.(OverloadedPointerDereferenceExpr).getExpr() = ele and
pred = "getExpr()"
or
expr.(CommaExpr).getLeftOperand() = ele and pred = "getLeftOperand()"
or
Expand Down
27 changes: 17 additions & 10 deletions cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ class FinalGlobalValue extends Node, TFinalGlobalValue {
override DataFlowType getType() {
exists(int indirectionIndex |
indirectionIndex = globalUse.getIndirectionIndex() and
result = getTypeImpl(globalUse.getUnspecifiedType(), indirectionIndex - 1)
result = getTypeImpl(globalUse.getUnderlyingType(), indirectionIndex - 1)
)
}

Expand Down Expand Up @@ -740,7 +740,7 @@ class InitialGlobalValue extends Node, TInitialGlobalValue {

override DataFlowType getType() {
exists(DataFlowType type |
type = globalDef.getUnspecifiedType() and
type = globalDef.getUnderlyingType() and
if this.isGLValue()
then result = type
else result = getTypeImpl(type, globalDef.getIndirectionIndex() - 1)
Expand Down Expand Up @@ -943,10 +943,13 @@ private Type getTypeImpl0(Type t, int indirectionIndex) {
indirectionIndex > 0 and
exists(Type stripped |
stripped = stripPointer(t.stripTopLevelSpecifiers()) and
// We need to avoid the case where `stripPointer(t) = t` (which can happen on
// iterators that specify a `value_type` that is the iterator itself). Such a type
// would create an infinite loop otherwise. For these cases we simply don't produce
// a result for `getTypeImpl`.
// We need to avoid the case where `stripPointer(t) = t` (which can happen
// on iterators that specify a `value_type` that is the iterator itself).
// Such a type would create an infinite loop otherwise. For these cases we
// simply don't produce a result for `getTypeImpl`.
// To be on the safe side, we check whether the _unspecified_ type has
// changed since this also prevents an infinite loop when `stripped` and
// `t` only differ by const'ness or volatile'ness.
stripped.getUnspecifiedType() != t.getUnspecifiedType() and
result = getTypeImpl0(stripped, indirectionIndex - 1)
)
Expand Down Expand Up @@ -996,12 +999,14 @@ private module RawIndirectNodes {

override Declaration getEnclosingCallable() { result = this.getFunction() }

override predicate isGLValue() { this.getOperand().isGLValue() }

override DataFlowType getType() {
exists(int sub, DataFlowType type, boolean isGLValue |
type = getOperandType(this.getOperand(), isGLValue) and
if isGLValue = true then sub = 1 else sub = 0
|
result = getTypeImpl(type.getUnspecifiedType(), indirectionIndex - sub)
result = getTypeImpl(type.getUnderlyingType(), indirectionIndex - sub)
)
}

Expand Down Expand Up @@ -1038,12 +1043,14 @@ private module RawIndirectNodes {

override Declaration getEnclosingCallable() { result = this.getFunction() }

override predicate isGLValue() { this.getInstruction().isGLValue() }

override DataFlowType getType() {
exists(int sub, DataFlowType type, boolean isGLValue |
type = getInstructionType(this.getInstruction(), isGLValue) and
if isGLValue = true then sub = 1 else sub = 0
|
result = getTypeImpl(type.getUnspecifiedType(), indirectionIndex - sub)
result = getTypeImpl(type.getUnderlyingType(), indirectionIndex - sub)
)
}

Expand Down Expand Up @@ -1136,7 +1143,7 @@ class FinalParameterNode extends Node, TFinalParameterNode {

override Declaration getEnclosingCallable() { result = this.getFunction() }

override DataFlowType getType() { result = getTypeImpl(p.getUnspecifiedType(), indirectionIndex) }
override DataFlowType getType() { result = getTypeImpl(p.getUnderlyingType(), indirectionIndex) }

final override Location getLocationImpl() {
// Parameters can have multiple locations. When there's a unique location we use
Expand Down Expand Up @@ -1789,7 +1796,7 @@ class VariableNode extends Node, TVariableNode {
}

override DataFlowType getType() {
result = getTypeImpl(v.getUnspecifiedType(), indirectionIndex - 1)
result = getTypeImpl(v.getUnderlyingType(), indirectionIndex - 1)
}

final override Location getLocationImpl() {
Expand Down
16 changes: 8 additions & 8 deletions cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/ProductFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -507,13 +507,13 @@ module ProductFlow {
private predicate pathSuccPlus(TNodePair n1, TNodePair n2) = fastTC(pathSucc/2)(n1, n2)

private predicate localPathStep1(Flow1::PathNode pred, Flow1::PathNode succ) {
Flow1::PathGraph::edges(pred, succ) and
Flow1::PathGraph::edges(pred, succ, _, _) and
pragma[only_bind_out](pred.getNode().getEnclosingCallable()) =
pragma[only_bind_out](succ.getNode().getEnclosingCallable())
}

private predicate localPathStep2(Flow2::PathNode pred, Flow2::PathNode succ) {
Flow2::PathGraph::edges(pred, succ) and
Flow2::PathGraph::edges(pred, succ, _, _) and
pragma[only_bind_out](pred.getNode().getEnclosingCallable()) =
pragma[only_bind_out](succ.getNode().getEnclosingCallable())
}
Expand All @@ -530,7 +530,7 @@ module ProductFlow {
TJump()

private predicate intoImpl1(Flow1::PathNode pred1, Flow1::PathNode succ1, DataFlowCall call) {
Flow1::PathGraph::edges(pred1, succ1) and
Flow1::PathGraph::edges(pred1, succ1, _, _) and
pred1.getNode().(ArgumentNode).getCall() = call and
succ1.getNode() instanceof ParameterNode
}
Expand All @@ -543,7 +543,7 @@ module ProductFlow {
}

private predicate outImpl1(Flow1::PathNode pred1, Flow1::PathNode succ1, DataFlowCall call) {
Flow1::PathGraph::edges(pred1, succ1) and
Flow1::PathGraph::edges(pred1, succ1, _, _) and
exists(ReturnKindExt returnKind |
succ1.getNode() = returnKind.getAnOutNode(call) and
pred1.getNode().(ReturnNodeExt).getKind() = returnKind
Expand All @@ -558,7 +558,7 @@ module ProductFlow {
}

private predicate intoImpl2(Flow2::PathNode pred2, Flow2::PathNode succ2, DataFlowCall call) {
Flow2::PathGraph::edges(pred2, succ2) and
Flow2::PathGraph::edges(pred2, succ2, _, _) and
pred2.getNode().(ArgumentNode).getCall() = call and
succ2.getNode() instanceof ParameterNode
}
Expand All @@ -571,7 +571,7 @@ module ProductFlow {
}

private predicate outImpl2(Flow2::PathNode pred2, Flow2::PathNode succ2, DataFlowCall call) {
Flow2::PathGraph::edges(pred2, succ2) and
Flow2::PathGraph::edges(pred2, succ2, _, _) and
exists(ReturnKindExt returnKind |
succ2.getNode() = returnKind.getAnOutNode(call) and
pred2.getNode().(ReturnNodeExt).getKind() = returnKind
Expand All @@ -590,7 +590,7 @@ module ProductFlow {
Declaration predDecl, Declaration succDecl, Flow1::PathNode pred1, Flow1::PathNode succ1,
TKind kind
) {
Flow1::PathGraph::edges(pred1, succ1) and
Flow1::PathGraph::edges(pred1, succ1, _, _) and
predDecl != succDecl and
pred1.getNode().getEnclosingCallable() = predDecl and
succ1.getNode().getEnclosingCallable() = succDecl and
Expand All @@ -610,7 +610,7 @@ module ProductFlow {
Declaration predDecl, Declaration succDecl, Flow2::PathNode pred2, Flow2::PathNode succ2,
TKind kind
) {
Flow2::PathGraph::edges(pred2, succ2) and
Flow2::PathGraph::edges(pred2, succ2, _, _) and
predDecl != succDecl and
pred2.getNode().getEnclosingCallable() = predDecl and
succ2.getNode().getEnclosingCallable() = succDecl and
Expand Down
44 changes: 18 additions & 26 deletions cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/SsaInternals.qll
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ private import codeql.ssa.Ssa as SsaImplCommon
private import semmle.code.cpp.ir.IR
private import DataFlowUtil
private import DataFlowImplCommon as DataFlowImplCommon
private import semmle.code.cpp.ir.dataflow.internal.ModelUtil
private import semmle.code.cpp.models.interfaces.Allocation as Alloc
private import semmle.code.cpp.models.interfaces.DataFlow as DataFlow
private import semmle.code.cpp.models.interfaces.FlowOutBarrier as FOB
private import semmle.code.cpp.models.interfaces.FunctionInputsAndOutputs as FIO
private import semmle.code.cpp.ir.internal.IRCppLanguage
private import DataFlowPrivate
private import ssa0.SsaInternals as SsaInternals0
Expand Down Expand Up @@ -548,6 +545,11 @@ class GlobalUse extends UseImpl, TGlobalUse {
*/
Type getUnspecifiedType() { result = global.getUnspecifiedType() }

/**
* Gets the type of this use, after typedefs have been resolved.
*/
Type getUnderlyingType() { result = global.getUnderlyingType() }

override predicate isCertain() { any() }

override BaseSourceVariableInstruction getBase() { none() }
Expand Down Expand Up @@ -591,11 +593,16 @@ class GlobalDefImpl extends DefOrUseImpl, TGlobalDefImpl {
int getIndirection() { result = indirectionIndex }

/**
* Gets the type of this use after specifiers have been deeply stripped
* and typedefs have been resolved.
* Gets the type of this definition after specifiers have been deeply
* stripped and typedefs have been resolved.
*/
Type getUnspecifiedType() { result = global.getUnspecifiedType() }

/**
* Gets the type of this definition, after typedefs have been resolved.
*/
Type getUnderlyingType() { result = global.getUnderlyingType() }

override string toString() { result = "Def of " + this.getSourceVariable() }

override Location getLocation() { result = f.getLocation() }
Expand Down Expand Up @@ -787,30 +794,10 @@ private Node getAPriorDefinition(SsaDefOrUse defOrUse) {
)
}

/**
* Holds if there should not be use-use flow out of `n` (or a conversion that
* flows to `n`).
*/
private predicate modeledFlowBarrier(Node n) {
exists(FIO::FunctionInput input, CallInstruction call |
call.getStaticCallTarget().(FOB::FlowOutBarrierFunction).isFlowOutBarrier(input) and
n = callInput(call, input)
)
or
exists(Operand operand, Instruction instr, Node n0, int indirectionIndex |
modeledFlowBarrier(n0) and
nodeHasInstruction(n0, instr, indirectionIndex) and
conversionFlow(operand, instr, false, _) and
nodeHasOperand(n, operand, indirectionIndex)
)
}

/** Holds if there is def-use or use-use flow from `nodeFrom` to `nodeTo`. */
predicate ssaFlow(Node nodeFrom, Node nodeTo) {
exists(Node nFrom, boolean uncertain, SsaDefOrUse defOrUse |
ssaFlowImpl(defOrUse, nFrom, nodeTo, uncertain) and
not modeledFlowBarrier(nFrom) and
nodeFrom != nodeTo
ssaFlowImpl(defOrUse, nFrom, nodeTo, uncertain) and nodeFrom != nodeTo
|
if uncertain = true then nodeFrom = [nFrom, getAPriorDefinition(defOrUse)] else nodeFrom = nFrom
)
Expand Down Expand Up @@ -1115,6 +1102,11 @@ class GlobalDef extends TGlobalDef, SsaDefOrUse {
*/
DataFlowType getUnspecifiedType() { result = global.getUnspecifiedType() }

/**
* Gets the type of this definition, after typedefs have been resolved.
*/
DataFlowType getUnderlyingType() { result = global.getUnderlyingType() }

/** Gets the `IRFunction` whose body is evaluated after this definition. */
IRFunction getIRFunction() { result = global.getIRFunction() }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ private module IRDeclarationEntries {
* This class exists to work around the fact that `DeclStmt`s in some cases
* do not have `DeclarationEntry`s. Currently, this is the case for:
* - `DeclStmt`s in template instantiations.
* - `DeclStmt`s that are generated by the desugaring of range-based for-loops.
*
* So instead, the IR works with `IRDeclarationEntry`s that synthesize missing
* `DeclarationEntry`s when there is no result for `DeclStmt::getDeclarationEntry`.
Expand Down
Loading
Loading