-
Notifications
You must be signed in to change notification settings - Fork 79
Check return value bounds #1150
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
Merged
Changes from 17 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
ec74226
Add FunctionDeclaration and ReturnVal members to CheckBoundsDeclarati…
e589681
Add ReturnStmt to the ProofStmtKind enum
e0e2bc3
Do not check for free variables if E1 or E2 is a _Return_value expres…
b53da94
Add ProveReturnBoundsValidity method
3d860c2
Add diagnostic note messages for declared and inferred return bounds
3055184
Add DiagnoseUnknownReturnBounds method
f821bf5
Add ValidateReturnBounds method
91a6128
Validate the return value bounds in CheckReturnStmt
0d29c2b
Change return values in bounds-decl-checking test to avoid return val…
bb3e9db
Mark the 3C test files functionDeclEnd.c and itype_nt_arr_cast.c as X…
1197e7c
Add return-bounds.c test file containing some initial tests for check…
9d369fd
Change 2 return values in dump-dataflow-facts.c test in order to avoi…
7bbc1f6
Add bounds-safe interface test cases to return-bounds.c
9013f6d
Fix the logic for recording equality between RetExpr and ReturnVal by…
8237d6c
Add tests for bounds casts to return-bounds.c
df46f91
Add tests for function calls to return-bounds.c
b613afb
Add no warnings/errors test case for expanded declared return bounds
f8a72a6
Skip checking return bounds in an unchecked scope, for functions with…
86ccdbf
Update return bounds tests (add more tests for bounds-safe interfaces)
489ec1a
Enable 3C/itype_nt_arr_cast.c test
7600025
Add checked/unchecked scope comments to 3C/functionDeclEnd.c test
7e966a6
Change test7 in functionDeclEnd.c to infer a valid bound
john-h-kastner d4a7eab
Merge branch 'master' of https://github.com/microsoft/checkedc-clang …
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function
ExpandToRangeonly expands count (or, byte_count) bounds expressions. Does this mean that in a range bounds expression likebounds(_Return_value, _Return_value + 2), the abstract place holder_Return_valuewill not be replaced by the concrete valueReturnVal?It will be great if a positive test case (no errors or warnings) with similar return bounds as in the test case
f10inclang/test/CheckedC/static-checking/return-bounds.cis added.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReturnValis a_Return_valueexpression (aBoundsValueExprwith theKindReturn). If a function has declared bounds ofcount(size),ExpandToRangewill returnbounds(_Return_value, _Return_value + size). If a function has declared bounds ofbounds(_Return_value, _Return_value + size),ExpandToRangewill returnbounds(_Return_value, _Return_value + size).I've added a test case for this (function
f7with no errors or warnings) to return-bounds.c.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks for the clarification.