-
Notifications
You must be signed in to change notification settings - Fork 77
Implement Memory1 (RULE-8-7-1)
#967
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
base: main
Are you sure you want to change the base?
Changes from 39 commits
b2231c9
9b5d8b2
a5d4127
1a2cde8
c21e862
c0b1e55
9d3bab0
a8a6db7
4464702
e2c5870
fe2a3c4
5ea652b
7b860d9
08b8bf7
062c62f
e264dfd
4d2bc8b
21500b8
e9f39a2
a62e2e1
ca62995
8abf097
f5454de
d82ed6e
356bbf2
4c4cf49
9ced913
1c5dc84
2f80208
0b7f024
8585568
610af04
fe1bb85
4989ff2
ccd7993
4780155
fd2713f
8ecc213
77fa2b7
a608d11
8435f3c
32be773
c56946a
cc0f80a
ae922a7
1286958
1085d38
332a98d
917e2ba
0b3a231
698570a
f1d3a40
5d2f62f
53c0ef7
19f8e94
2d6c9eb
9493945
212b266
e3c80f5
369c99b
9272117
4bcc59f
14bdcbd
d254ec2
a692ba7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| //** THIS FILE IS AUTOGENERATED, DO NOT MODIFY DIRECTLY. **/ | ||
| import cpp | ||
| import RuleMetadata | ||
| import codingstandards.cpp.exclusions.RuleMetadata | ||
|
|
||
| newtype Memory1Query = | ||
| TPointerArithmeticFormsAnInvalidPointerQuery() or | ||
| TPointerArgumentToCstringFunctionIsInvalidQuery() | ||
|
|
||
| predicate isMemory1QueryMetadata(Query query, string queryId, string ruleId, string category) { | ||
| query = | ||
| // `Query` instance for the `pointerArithmeticFormsAnInvalidPointer` query | ||
| Memory1Package::pointerArithmeticFormsAnInvalidPointerQuery() and | ||
| queryId = | ||
| // `@id` for the `pointerArithmeticFormsAnInvalidPointer` query | ||
| "cpp/misra/pointer-arithmetic-forms-an-invalid-pointer" and | ||
| ruleId = "RULE-8-7-1" and | ||
| category = "required" | ||
| or | ||
| query = | ||
| // `Query` instance for the `pointerArgumentToCstringFunctionIsInvalid` query | ||
| Memory1Package::pointerArgumentToCstringFunctionIsInvalidQuery() and | ||
| queryId = | ||
| // `@id` for the `pointerArgumentToCstringFunctionIsInvalid` query | ||
| "cpp/misra/pointer-argument-to-cstring-function-is-invalid" and | ||
| ruleId = "RULE-8-7-1" and | ||
| category = "required" | ||
| } | ||
|
|
||
| module Memory1Package { | ||
| Query pointerArithmeticFormsAnInvalidPointerQuery() { | ||
| //autogenerate `Query` type | ||
| result = | ||
| // `Query` type for `pointerArithmeticFormsAnInvalidPointer` query | ||
| TQueryCPP(TMemory1PackageQuery(TPointerArithmeticFormsAnInvalidPointerQuery())) | ||
| } | ||
|
|
||
| Query pointerArgumentToCstringFunctionIsInvalidQuery() { | ||
| //autogenerate `Query` type | ||
| result = | ||
| // `Query` type for `pointerArgumentToCstringFunctionIsInvalid` query | ||
| TQueryCPP(TMemory1PackageQuery(TPointerArgumentToCstringFunctionIsInvalidQuery())) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /** | ||
| * @id cpp/misra/pointer-argument-to-cstring-function-is-invalid | ||
| * @name RULE-8-7-1: Pointer and index arguments passed to functions in <cstring> shall not be invalid | ||
| * @description Pointer and index arguments passed to functions in <cstring> should result in valid | ||
| * reads and/or writes. | ||
| * @kind problem | ||
| * @precision high | ||
| * @problem.severity error | ||
| * @tags external/misra/id/rule-8-7-1 | ||
| * scope/system | ||
| * external/misra/enforcement/undecidable | ||
| * external/misra/obligation/required | ||
| */ | ||
|
|
||
| import cpp | ||
| import codingstandards.cpp.OutOfBounds // for OOB::problems | ||
| import codingstandards.cpp.Exclusions // for isExcluded(Element, Query) | ||
| import codingstandards.cpp.exclusions.c.RuleMetadata | ||
|
|
||
| from | ||
| OOB::BufferAccessLibraryFunctionCall fc, string message, Expr bufferArg, string bufferArgStr, | ||
| Expr sizeOrOtherBufferArg, string otherStr | ||
| where | ||
| not isExcluded(fc, OutOfBoundsPackage::libraryFunctionArgumentOutOfBoundsQuery()) and | ||
|
||
| OOB::problems(fc, message, bufferArg, bufferArgStr, sizeOrOtherBufferArg, otherStr) | ||
| select fc, message, bufferArg, bufferArgStr, sizeOrOtherBufferArg, otherStr | ||
Uh oh!
There was an error while loading. Please reload this page.