-
Notifications
You must be signed in to change notification settings - Fork 68
Update more queries to the new dataflow library #949
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 all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f0d4694
Convert `ThrowingOperatorNewReturnsNull` to the new dataflow library
jketema b6a4ae9
Convert `PredicateFunctionObjectsShouldNotBeMutable` to the new dataf…
jketema ca1667f
Remove redundant dataflow import
jketema e643526
Convert `OnlyFreeMemoryAllocatedDynamicallyShared` to the new dataflo…
jketema 0f50470
Convert `InvalidatedEnvStringPointers` to the new dataflow library
jketema 493a4c1
Convert `FunctionErroneousReturnValueNotTested` to the new dataflow l…
jketema 8a672b1
Update `DoNotPassAliasedPointerToRestrictQualifiedParamShared` to the…
jketema 3bfaf5b
Convert M9-3-1 to the new dataflow library
jketema 56cc455
Convert A8-4-9 to the new dataflow library
jketema 6384dbd
Conver A8-4-11 to the new dataflow library
jketema 113c121
Convert STR31-C to the new dataflow library
jketema f265690
Convert `FileStreams.qll` to the new dataflow library
jketema 146d85a
Convert `DoNotAccessAClosedFile` to the new dataflow library
jketema 4d16b3b
Update `OwnedPointerValueStoredInUnrelatedSmartPointer` to the new da…
jketema 3b05adc
Update `MovedFromObjectsUnspecifiedState` to the new dataflow library
jketema ab5a471
Update `DoNotUseRelationalOperatorsWithDifferingArrays` to the new da…
jketema 590cd5a
Convert `DanglingCaptureWhenReturningLambdaObject` to the new dataflo…
jketema 42838bf
Update `DanglingCaptureWhenMovingLambdaObject` to the new dataflow li…
jketema a11320c
Update `ConstLikeReturnValue` to the new dataflow library
jketema 99b45ad
Remove redundant dataflow import
jketema 5e701b5
Convert `BasicStringMayNotBeNullTerminated` to the new dataflow library
jketema 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
6 changes: 0 additions & 6 deletions
6
c/cert/test/rules/STR31-C/StringsHasSufficientSpaceForTheNullTerminator.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
19 changes: 14 additions & 5 deletions
19
c/common/test/rules/constlikereturnvalue/ConstLikeReturnValue.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,20 +1,29 @@ | ||
problems | ||
| test.c:11:8:11:12 | c_str | test.c:18:16:18:21 | call to getenv | test.c:11:8:11:12 | c_str | The object returned by the function getenv should not be modified. | | ||
| test.c:11:7:11:12 | * ... | test.c:18:16:18:21 | call to getenv | test.c:11:7:11:12 | * ... | The object returned by the function getenv should not be modified. | | ||
| test.c:11:8:11:12 | c_str | test.c:18:16:18:21 | call to getenv | test.c:11:7:11:12 | * ... | The object returned by the function getenv should not be modified. | | ||
| test.c:67:5:67:9 | conv4 | test.c:64:11:64:20 | call to localeconv | test.c:67:5:67:9 | conv4 | The object returned by the function localeconv should not be modified. | | ||
| test.c:76:5:76:8 | conv | test.c:72:25:72:34 | call to localeconv | test.c:76:5:76:8 | conv | The object returned by the function localeconv should not be modified. | | ||
edges | ||
| test.c:8:18:8:22 | c_str | test.c:11:8:11:12 | c_str | provenance | | | ||
| test.c:8:18:8:22 | c_str | test.c:11:7:11:12 | * ... | provenance | | | ||
| test.c:18:16:18:21 | call to getenv | test.c:18:16:18:21 | call to getenv | provenance | | | ||
| test.c:18:16:18:21 | call to getenv | test.c:24:9:24:12 | env1 | provenance | | | ||
| test.c:24:9:24:12 | env1 | test.c:8:18:8:22 | c_str | provenance | | | ||
| test.c:64:11:64:20 | call to localeconv | test.c:67:5:67:9 | conv4 | provenance | | | ||
| test.c:72:25:72:34 | call to localeconv | test.c:76:5:76:8 | conv | provenance | | | ||
| test.c:64:3:64:22 | ... = ... | test.c:67:5:67:9 | conv4 | provenance | | | ||
| test.c:64:11:64:20 | call to localeconv | test.c:64:3:64:22 | ... = ... | provenance | | | ||
| test.c:72:25:72:34 | call to localeconv | test.c:72:25:72:34 | call to localeconv | provenance | | | ||
| test.c:72:25:72:34 | call to localeconv | test.c:73:24:73:28 | conv4 | provenance | | | ||
| test.c:73:24:73:28 | conv4 | test.c:76:5:76:8 | conv | provenance | | | ||
nodes | ||
| test.c:8:18:8:22 | c_str | semmle.label | c_str | | ||
| test.c:11:8:11:12 | c_str | semmle.label | c_str | | ||
| test.c:11:7:11:12 | * ... | semmle.label | * ... | | ||
| test.c:18:16:18:21 | call to getenv | semmle.label | call to getenv | | ||
| test.c:18:16:18:21 | call to getenv | semmle.label | call to getenv | | ||
| test.c:24:9:24:12 | env1 | semmle.label | env1 | | ||
| test.c:64:3:64:22 | ... = ... | semmle.label | ... = ... | | ||
| test.c:64:11:64:20 | call to localeconv | semmle.label | call to localeconv | | ||
| test.c:67:5:67:9 | conv4 | semmle.label | conv4 | | ||
| test.c:72:25:72:34 | call to localeconv | semmle.label | call to localeconv | | ||
| test.c:72:25:72:34 | call to localeconv | semmle.label | call to localeconv | | ||
| test.c:73:24:73:28 | conv4 | semmle.label | conv4 | | ||
| test.c:76:5:76:8 | conv | semmle.label | conv | | ||
subpaths |
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
2 changes: 0 additions & 2 deletions
2
cpp/autosar/test/rules/A8-4-11/SmartPointerAsParameterWithoutLifetimeSemantics.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,5 +1,3 @@ | ||
WARNING: module 'DataFlow' has been deprecated and may be removed in future (SmartPointerAsParameterWithoutLifetimeSemantics.ql:47,3-11) | ||
WARNING: module 'DataFlow' has been deprecated and may be removed in future (SmartPointerAsParameterWithoutLifetimeSemantics.ql:56,5-13) | ||
| test.cpp:7:41:7:43 | up1 | Function $@ takes smart pointer parameter 'up1' but does not implement any lifetime-affecting operations. | test.cpp:7:6:7:18 | smart_ptr_get | smart_ptr_get | | ||
| test.cpp:16:53:16:55 | sp1 | Function $@ takes smart pointer parameter 'sp1' but does not implement any lifetime-affecting operations. | test.cpp:16:6:16:29 | smart_ptr_ref_assign_ref | smart_ptr_ref_assign_ref | | ||
| test.cpp:28:55:28:57 | sp1 | Function $@ takes smart pointer parameter 'sp1' but does not implement any lifetime-affecting operations. | test.cpp:28:6:28:31 | smart_ptr_ref_noncompliant | smart_ptr_ref_noncompliant | |
2 changes: 0 additions & 2 deletions
2
cpp/autosar/test/rules/A8-4-9/InOutParametersDeclaredAsTNotModified.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
2 changes: 0 additions & 2 deletions
2
cpp/autosar/test/rules/M9-3-1/ConstMemberFunctionReturnsNonConstPointer.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,5 +1,3 @@ | ||
WARNING: module 'DataFlow' has been deprecated and may be removed in future (ConstMemberFunctionReturnsNonConstPointer.ql:53,7-15) | ||
WARNING: module 'DataFlow' has been deprecated and may be removed in future (ConstMemberFunctionReturnsNonConstPointer.ql:55,7-15) | ||
| test.cpp:8:8:8:11 | getA | Const member function returns a pointer to class data $@. | test.cpp:3:8:3:8 | a | a | | ||
| test.cpp:9:8:9:11 | getB | Const member function returns a pointer to class data $@. | test.cpp:4:8:4:8 | b | b | | ||
| test.cpp:11:6:11:12 | getThis | Const member function returns a pointer to class data $@. | test.cpp:11:36:11:39 | this | this | |
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
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,7 +4,7 @@ | |||||
*/ | ||||||
|
||||||
import cpp | ||||||
import semmle.code.cpp.dataflow.DataFlow | ||||||
import semmle.code.cpp.dataflow.new.DataFlow | ||||||
import codingstandards.cpp.Exclusions | ||||||
import codingstandards.cpp.standardlibrary.Utility | ||||||
|
||||||
|
@@ -75,9 +75,10 @@ query predicate problems(Expr e, string message, StdMoveCall f, string argDesc) | |||||
not e instanceof ReassignedExpression and | ||||||
// object moved to safe functions are preserved | ||||||
not exists(SafeRead safe | f = safe.getArgument(0)) and | ||||||
exists(DataFlow::DefinitionByReferenceNode def | | ||||||
def.asDefiningArgument() = f and | ||||||
DataFlow::localFlow(def, DataFlow::exprNode(e)) | ||||||
exists(DataFlow::DefinitionByReferenceNode def, DataFlow::Node n | | ||||||
f.getArgument(0) = def.getArgument() and | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The API change from
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
n.asIndirectExpr() = e and | ||||||
DataFlow::localFlow(def, n) | ||||||
) and | ||||||
message = "The argument of the $@ may be indeterminate when accessed at this location." and | ||||||
argDesc = f.toString() | ||||||
|
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.
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.
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.
Inconsistent API usage:
def.asDefiningArgument()
is used here but replaced withdef.getArgument()
in other files. This should be updated for consistency with the new dataflow library migration.Copilot uses AI. Check for mistakes.