-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: stitch paths and ignore cast arrays in constant off-by-one query #13045
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
Merged
rdmarsh2
merged 12 commits into
github:main
from
rdmarsh2:rdmarsh2/cpp/improve-constant-off-by-one
May 26, 2023
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3abf5d1
C++: stitch paths in array off-by-one query
rdmarsh2 d9665e1
C++: add case test for constant off-by-one query
rdmarsh2 b7653ec
C++: ignore cast arrays in constant off-by-one query
rdmarsh2 f77c77f
C++: refactor off-by-one query to use flowstate
rdmarsh2 584adf8
C++: restrict flowstates in constant off-by-one query
rdmarsh2 bf07b0f
C++: fix cxartesian product in constant off-by-one query
rdmarsh2 604affd
C++: autoformat
rdmarsh2 4ed7450
C++: remove unneeded pragma
rdmarsh2 64d7b49
C++: Prune flow states based on 'PointerArithmeticToDerefConfig'.
MathiasVP 298013a
C++: Add in-barrier on sources to reduce duplication.
MathiasVP ebc1d5f
Merge branch 'main' into rdmarsh2/cpp/improve-constant-off-by-one
MathiasVP c3fdc83
C++: Also add an out barrier on all sinks.
MathiasVP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 31 additions & 22 deletions
53
...imental/query-tests/Security/CWE/CWE-193/constant-size/ConstantSizeArrayOffByOne.expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,46 @@ | ||
edges | ||
| test.cpp:66:32:66:32 | p | test.cpp:66:32:66:32 | p | | ||
| test.cpp:66:32:66:32 | p | test.cpp:67:5:67:6 | * ... | | ||
| test.cpp:66:32:66:32 | p | test.cpp:67:6:67:6 | p | | ||
| test.cpp:35:10:35:12 | buf | test.cpp:35:5:35:22 | access to array | | ||
| test.cpp:36:10:36:12 | buf | test.cpp:36:5:36:24 | access to array | | ||
| test.cpp:43:14:43:16 | buf | test.cpp:43:9:43:19 | access to array | | ||
| test.cpp:49:10:49:12 | buf | test.cpp:49:5:49:22 | access to array | | ||
| test.cpp:50:10:50:12 | buf | test.cpp:50:5:50:24 | access to array | | ||
| test.cpp:57:14:57:16 | buf | test.cpp:57:9:57:19 | access to array | | ||
| test.cpp:61:14:61:16 | buf | test.cpp:61:9:61:19 | access to array | | ||
| test.cpp:70:33:70:33 | p | test.cpp:72:5:72:15 | access to array | | ||
| test.cpp:77:26:77:44 | & ... | test.cpp:66:32:66:32 | p | | ||
| test.cpp:77:26:77:44 | & ... | test.cpp:66:32:66:32 | p | | ||
| test.cpp:77:27:77:44 | access to array | test.cpp:77:26:77:44 | & ... | | ||
| test.cpp:77:32:77:34 | buf | test.cpp:77:26:77:44 | & ... | | ||
| test.cpp:79:27:79:34 | buf | test.cpp:70:33:70:33 | p | | ||
| test.cpp:79:32:79:34 | buf | test.cpp:79:27:79:34 | buf | | ||
nodes | ||
| test.cpp:35:5:35:22 | access to array | semmle.label | access to array | | ||
| test.cpp:35:10:35:12 | buf | semmle.label | buf | | ||
| test.cpp:36:5:36:24 | access to array | semmle.label | access to array | | ||
| test.cpp:36:10:36:12 | buf | semmle.label | buf | | ||
| test.cpp:43:9:43:19 | access to array | semmle.label | access to array | | ||
| test.cpp:43:14:43:16 | buf | semmle.label | buf | | ||
| test.cpp:49:5:49:22 | access to array | semmle.label | access to array | | ||
| test.cpp:49:10:49:12 | buf | semmle.label | buf | | ||
| test.cpp:50:5:50:24 | access to array | semmle.label | access to array | | ||
| test.cpp:50:10:50:12 | buf | semmle.label | buf | | ||
| test.cpp:57:9:57:19 | access to array | semmle.label | access to array | | ||
| test.cpp:57:14:57:16 | buf | semmle.label | buf | | ||
| test.cpp:61:9:61:19 | access to array | semmle.label | access to array | | ||
| test.cpp:61:14:61:16 | buf | semmle.label | buf | | ||
| test.cpp:66:32:66:32 | p | semmle.label | p | | ||
| test.cpp:66:32:66:32 | p | semmle.label | p | | ||
| test.cpp:66:32:66:32 | p | semmle.label | p | | ||
| test.cpp:67:5:67:6 | * ... | semmle.label | * ... | | ||
| test.cpp:67:6:67:6 | p | semmle.label | p | | ||
| test.cpp:70:33:70:33 | p | semmle.label | p | | ||
| test.cpp:72:5:72:15 | access to array | semmle.label | access to array | | ||
| test.cpp:77:26:77:44 | & ... | semmle.label | & ... | | ||
| test.cpp:77:27:77:44 | access to array | semmle.label | access to array | | ||
| test.cpp:77:32:77:34 | buf | semmle.label | buf | | ||
| test.cpp:79:27:79:34 | buf | semmle.label | buf | | ||
| test.cpp:79:32:79:34 | buf | semmle.label | buf | | ||
subpaths | ||
#select | ||
| test.cpp:35:5:35:22 | access to array | test.cpp:35:5:35:22 | access to array | test.cpp:35:5:35:22 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:35:5:35:26 | Store: ... = ... | write | | ||
| test.cpp:36:5:36:24 | access to array | test.cpp:36:5:36:24 | access to array | test.cpp:36:5:36:24 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:36:5:36:28 | Store: ... = ... | write | | ||
| test.cpp:43:9:43:19 | access to array | test.cpp:43:9:43:19 | access to array | test.cpp:43:9:43:19 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:43:9:43:23 | Store: ... = ... | write | | ||
| test.cpp:49:5:49:22 | access to array | test.cpp:49:5:49:22 | access to array | test.cpp:49:5:49:22 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:49:5:49:26 | Store: ... = ... | write | | ||
| test.cpp:50:5:50:24 | access to array | test.cpp:50:5:50:24 | access to array | test.cpp:50:5:50:24 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:50:5:50:28 | Store: ... = ... | write | | ||
| test.cpp:57:9:57:19 | access to array | test.cpp:57:9:57:19 | access to array | test.cpp:57:9:57:19 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:57:9:57:23 | Store: ... = ... | write | | ||
| test.cpp:61:9:61:19 | access to array | test.cpp:61:9:61:19 | access to array | test.cpp:61:9:61:19 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:61:9:61:23 | Store: ... = ... | write | | ||
| test.cpp:72:5:72:15 | access to array | test.cpp:72:5:72:15 | access to array | test.cpp:72:5:72:15 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:72:5:72:19 | Store: ... = ... | write | | ||
| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:66:32:66:32 | p | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write | | ||
| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:66:32:66:32 | p | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write | | ||
| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:67:5:67:6 | * ... | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write | | ||
| test.cpp:77:27:77:44 | access to array | test.cpp:77:27:77:44 | access to array | test.cpp:67:6:67:6 | p | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write | | ||
| test.cpp:35:5:35:22 | PointerAdd: access to array | test.cpp:35:10:35:12 | buf | test.cpp:35:5:35:22 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:35:5:35:26 | Store: ... = ... | write | | ||
| test.cpp:36:5:36:24 | PointerAdd: access to array | test.cpp:36:10:36:12 | buf | test.cpp:36:5:36:24 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:36:5:36:28 | Store: ... = ... | write | | ||
| test.cpp:43:9:43:19 | PointerAdd: access to array | test.cpp:43:14:43:16 | buf | test.cpp:43:9:43:19 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:43:9:43:23 | Store: ... = ... | write | | ||
| test.cpp:49:5:49:22 | PointerAdd: access to array | test.cpp:49:10:49:12 | buf | test.cpp:49:5:49:22 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:49:5:49:26 | Store: ... = ... | write | | ||
| test.cpp:50:5:50:24 | PointerAdd: access to array | test.cpp:50:10:50:12 | buf | test.cpp:50:5:50:24 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:50:5:50:28 | Store: ... = ... | write | | ||
| test.cpp:57:9:57:19 | PointerAdd: access to array | test.cpp:57:14:57:16 | buf | test.cpp:57:9:57:19 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:57:9:57:23 | Store: ... = ... | write | | ||
| test.cpp:61:9:61:19 | PointerAdd: access to array | test.cpp:61:14:61:16 | buf | test.cpp:61:9:61:19 | access to array | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:19:9:19:11 | buf | buf | test.cpp:61:9:61:23 | Store: ... = ... | write | | ||
| test.cpp:72:5:72:15 | PointerAdd: access to array | test.cpp:79:32:79:34 | buf | test.cpp:72:5:72:15 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:72:5:72:19 | Store: ... = ... | write | | ||
| test.cpp:77:27:77:44 | PointerAdd: access to array | test.cpp:77:32:77:34 | buf | test.cpp:66:32:66:32 | p | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:15:9:15:11 | buf | buf | test.cpp:67:5:67:10 | Store: ... = ... | write | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check warning
Code scanning / CodeQL
Candidate predicate not marked as `nomagic`