Skip to content

Commit 585acc9

Browse files
authored
Merge pull request #54 from mbaluda-org/mbaluda/implementation_notes
Fix misplaced impl. scope and update help files
2 parents 1440fb8 + 4a6bb87 commit 585acc9

25 files changed

+141
-203
lines changed

c/cert/src/rules/CON31-C/DoNotAllowAMutexToGoOutOfScopeWhileLocked.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ CWE-667 = Union, CON31-C, POS48-C, list) where list =
165165

166166
## Implementation notes
167167

168-
None
168+
This implementation does not allow for thread synchronization to be performed in subroutines. All synchronization must be performed within the context of the other thread management functions.
169169

170170
## References
171171

c/cert/src/rules/CON37-C/DoNotCallSignalInMultithreadedProgram.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ Search for [vulnerabilities](https://wiki.sei.cmu.edu/confluence/display/c/BB.+D
105105

106106
## Implementation notes
107107

108+
This implementation does not consider threads created function pointers.
109+
108110
## References
109111

110112
* CERT-C: [CON37-C: Do not call signal() in a multithreaded program](https://wiki.sei.cmu.edu/confluence/display/c)

c/cert/src/rules/CON38-C/PreserveSafetyWhenUsingConditionVariables.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Search for [vulnerabilities](https://www.securecoding.cert.org/confluence/displa
350350

351351
## Implementation notes
352352

353-
None
353+
This implementation does not attempt to identify unique condition variables and instead advocates for the usage of `cnd_broadcast`.
354354

355355
## References
356356

c/cert/src/rules/CON41-C/WrapFunctionsThatCanFailSpuriouslyInLoop.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Search for [vulnerabilities](https://www.securecoding.cert.org/confluence/displa
149149
150150
## Implementation notes
151151
152-
None
152+
This implementation does not attempt to identify a relationship between the condition variable and the atomic operation.
153153
154154
## References
155155

c/cert/src/rules/ENV31-C/EnvPointerIsInvalidAfterCertainOperations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Search for vulnerabilities resulting from the violation of this rule on the [CER
218218

219219
## Implementation notes
220220

221-
None
221+
The rule is enforced in the context of a single function.
222222

223223
## References
224224

c/cert/src/rules/FIO32-C/DoNotPerformFileOperationsOnDevices.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ FIO32-C = Union( CWE-67, list) where list =
249249

250250
## Implementation notes
251251

252-
None
252+
The rule checks that filenames are not tainted. It does not verify that appropriate OS-specific checks are in place to exclude that the opened file is a device.
253253

254254
## References
255255

c/cert/src/rules/FIO34-C/DistinguishBetweenCharReadFromAFileAndEofOrWeof.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Therefore: FIO34-C = Subset( CWE-197)
199199

200200
## Implementation notes
201201

202-
None
202+
The rule is enforced in the context of a single function. The query does not validate if the FILE status is handled correctly after being read.
203203

204204
## References
205205

c/cert/src/rules/FIO34-C/EndOfFileCheckPortability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Therefore: FIO34-C = Subset( CWE-197)
199199

200200
## Implementation notes
201201

202-
None
202+
The rule is enforced in the context of a single function. The query does not validate if the FILE status is handled correctly after being read.
203203

204204
## References
205205

c/cert/src/rules/FIO37-C/SuccessfulFgetsOrFgetwsMayReturnAnEmptyString.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ CWE-241 = Union( FIO37-C, list) where list =
102102

103103
## Implementation notes
104104

105-
None
105+
The rule checks that access to a string returned by fgets() or fgetws() if protected by a guard condition. The rule is enforced in the context of a single function.
106106

107107
## References
108108

c/cert/src/rules/FIO39-C/DoNotAlternatelyIOFromAStreamWithoutPositioning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ This CWE is vague on what constitutes “improper control of a resource”. It c
135135

136136
## Implementation notes
137137

138-
None
138+
The rule is enforced in the context of a single function.
139139

140140
## References
141141

c/cert/src/rules/FIO42-C/CloseFilesWhenTheyAreNoLongerNeeded.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ FIO42-C - CWE-403 = SPECIAL_CASES, where SPECIAL_CASES =
229229

230230
## Implementation notes
231231

232-
None
232+
The rule is enforced in the context of a single function.
233233

234234
## References
235235

c/cert/src/rules/FIO46-C/UndefinedBehaviorAccessingAClosedFile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Search for [vulnerabilities](https://wiki.sei.cmu.edu/confluence/display/c/BB.+D
6868

6969
## Implementation notes
7070

71-
None
71+
The rule is enforced in the context of a single function.
7272

7373
## References
7474

c/cert/src/rules/MSC32-C/ProperlySeedPseudorandomNumberGenerators.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ MSC30-C, MSC32-C and CON33-C are independent, they have no intersections. They e
162162

163163
## Implementation notes
164164

165-
None
165+
This rule will be checked by looking for calls to random that are no preceded by a call to srandom(). We perform a simple check for the argument to srandom() and verify it is not a literal (or a value easily deduced to be a literal).
166166

167167
## References
168168

c/cert/src/rules/STR31-C/StringsHasSufficientSpaceForTheNullTerminator.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ Copying string data to a buffer that is too small to hold that data results in a
475475
476476
Array access out of bounds, Buffer overflow from incorrect string format specifier, Destination buffer overflow in string manipulation, Invalid use of standard library string routine, Missing null in string array, Pointer access out of bounds, Tainted NULL or non-null-terminated string, Use of dangerous standard function
477477
478-
<table> <tbody> <tr> <th> Tool </th> <th> Version </th> <th> Checker </th> <th> Description </th> </tr> <tr> <td> <a> Astrée </a> </td> <td> 22.04 </td> <td> </td> <td> Supported Astrée reports all buffer overflows resulting from copying data to a buffer that is not large enough to hold that data. </td> </tr> <tr> <td> <a> Axivion Bauhaus Suite </a> </td> <td> 7.2.0 </td> <td> <strong>CertC-STR31</strong> </td> <td> Detects calls to unsafe string function that may cause buffer overflow Detects potential buffer overruns, including those caused by unsafe usage of <code>fscanf()</code> </td> </tr> <tr> <td> <a> CodeSonar </a> </td> <td> 7.0p0 </td> <td> <strong>LANG.MEM.BO</strong> <strong>LANG.MEM.TO</strong> <strong>MISC.MEM.NTERM</strong> <strong>BADFUNC.BO.\*</strong> </td> <td> Buffer overrun Type overrun No space for null terminator A collection of warning classes that report uses of library functions prone to internal buffer overflows </td> </tr> <tr> <td> <a> Compass/ROSE </a> </td> <td> </td> <td> </td> <td> Can detect violations of the rule. However, it is unable to handle cases involving <code>strcpy_s()</code> or manual string copies such as the one in the first example </td> </tr> <tr> <td> <a> Coverity </a> </td> <td> 2017.07 </td> <td> <strong>STRING_OVERFLOW</strong> <strong>BUFFER_SIZE</strong> <strong>OVERRUN</strong> <strong>STRING_SIZE</strong> </td> <td> Fully implemented </td> </tr> <tr> <td> <a> Fortify SCA </a> </td> <td> 5.0 </td> <td> </td> <td> </td> </tr> <tr> <td> <a> Helix QAC </a> </td> <td> 2022.2 </td> <td> <strong>C2840, C2841, C2842, C2843, C2845, C2846, C2847, C2848, C2930, C2931, C2932, C2933, C2935, C2936, C2937, C2938</strong> <strong>C++0145, C++2840, C++2841, C++2842, C++2843, C++2845, C++2846, C++2847, C++2848, C++2930, C++2931, C++2932, C++2933, C++2935, C++2936, C++2937, C++2938</strong> </td> <td> </td> </tr> <tr> <td> <a> Klocwork </a> </td> <td> 2022.2 </td> <td> <strong>SV.FMT_STR.BAD_SCAN_FORMAT</strong> <strong>SV.UNBOUND_STRING_INPUT.FUNC</strong> </td> <td> </td> </tr> <tr> <td> <a> LDRA tool suite </a> </td> <td> 9.7.1 </td> <td> <strong>489 S, 109 D, 66 X, 70 X, 71 X</strong> </td> <td> Partially implemented </td> </tr> <tr> <td> <a> Parasoft C/C++test </a> </td> <td> 2022.1 </td> <td> <strong>CERT_C-STR31-a</strong> <strong>CERT_C-STR31-b</strong> <strong>CERT_C-STR31-c</strong> <strong>CERT_C-STR31-d</strong> <strong>CERT_C-STR31-e</strong> </td> <td> Avoid accessing arrays out of bounds Avoid overflow when writing to a buffer Prevent buffer overflows from tainted data Avoid buffer write overflow from tainted data Avoid using unsafe string functions which may cause buffer overflows </td> </tr> <tr> <td> <a> PC-lint Plus </a> </td> <td> 1.4 </td> <td> <strong>421, 498</strong> </td> <td> Partially supported </td> </tr> <tr> <td> <a> Polyspace Bug Finder </a> </td> <td> R2022a </td> <td> <a> CERT C: Rule STR31-C </a> </td> <td> Checks for: Use of dangerous standard functionse of dangerous standard function, missing null in string arrayissing null in string array, buffer overflow from incorrect string format specifieruffer overflow from incorrect string format specifier, destination buffer overflow in string manipulationestination buffer overflow in string manipulation, tainted null or non-null-terminated stringainted null or non-null-terminated string. Rule partially covered. </td> </tr> <tr> <td> <a> PRQA QA-C </a> </td> <td> 9.7 </td> <td> <strong>5009, 5038, 2840, 2841, 2842, 2843, 2845, 2846, 2847, 2848, 2930, 2931, 2932, 2933, 2935, 2936, 2937, 2938</strong> </td> <td> Partially implemented </td> </tr> <tr> <td> <a> PRQA QA-C++ </a> </td> <td> 4.4 </td> <td> <strong>0145, 2840, 2841, 2842, 2843, 2845, 2846, 2847, 2848, 2930, 2931, 2932, 2933, 2935, 2936, 2937, 2938, 5006, 5038</strong> </td> <td> </td> </tr> <tr> <td> <a> PVS-Studio </a> </td> <td> 7.19 </td> <td> <strong>V518<a></a></strong> , <strong>V645<a></a></strong> , <strong>V727<a></a></strong> , <strong><a>V755</a></strong> </td> <td> </td> </tr> <tr> <td> <a> Splint </a> </td> <td> 3.1.1 </td> <td> </td> <td> </td> </tr> <tr> <td> <a> TrustInSoft Analyzer </a> </td> <td> 1.38 </td> <td> <strong>mem_access</strong> </td> <td> Exhaustively verified (see <a> one compliant and one non-compliant example </a> ). </td> </tr> </tbody> </table>
478+
<table> <tbody> <tr> <th> Tool </th> <th> Version </th> <th> Checker </th> <th> Description </th> </tr> <tr> <td> <a> Astrée </a> </td> <td> 22.04 </td> <td> </td> <td> Supported Astrée reports all buffer overflows resulting from copying data to a buffer that is not large enough to hold that data. </td> </tr> <tr> <td> <a> Axivion Bauhaus Suite </a> </td> <td> 7.2.0 </td> <td> <strong>CertC-STR31</strong> </td> <td> Detects calls to unsafe string function that may cause buffer overflow Detects potential buffer overruns, including those caused by unsafe usage of <code>fscanf()</code> </td> </tr> <tr> <td> <a> CodeSonar </a> </td> <td> 7.0p0 </td> <td> <strong>LANG.MEM.BO</strong> <strong>LANG.MEM.TO</strong> <strong>MISC.MEM.NTERM</strong> <strong>BADFUNC.BO.\*</strong> </td> <td> Buffer overrun Type overrun No space for null terminator A collection of warning classes that report uses of library functions prone to internal buffer overflows </td> </tr> <tr> <td> <a> Compass/ROSE </a> </td> <td> </td> <td> </td> <td> Can detect violations of the rule. However, it is unable to handle cases involving <code>strcpy_s()</code> or manual string copies such as the one in the first example </td> </tr> <tr> <td> <a> Coverity </a> </td> <td> 2017.07 </td> <td> <strong>STRING_OVERFLOW</strong> <strong>BUFFER_SIZE</strong> <strong>OVERRUN</strong> <strong>STRING_SIZE</strong> </td> <td> Fully implemented </td> </tr> <tr> <td> <a> Fortify SCA </a> </td> <td> 5.0 </td> <td> </td> <td> </td> </tr> <tr> <td> <a> Helix QAC </a> </td> <td> 2022.2 </td> <td> <strong>C2840, C2841, C2842, C2843, C2845, C2846, C2847, C2848, C2930, C2931, C2932, C2933, C2935, C2936, C2937, C2938</strong> <strong>C++0145, C++2840, C++2841, C++2842, C++2843, C++2845, C++2846, C++2847, C++2848, C++2930, C++2931, C++2932, C++2933, C++2935, C++2936, C++2937, C++2938</strong> </td> <td> </td> </tr> <tr> <td> <a> Klocwork </a> </td> <td> 2022.2 </td> <td> <strong>SV.FMT_STR.BAD_SCAN_FORMAT</strong> <strong>SV.UNBOUND_STRING_INPUT.FUNC</strong> </td> <td> </td> </tr> <tr> <td> <a> LDRA tool suite </a> </td> <td> 9.7.1 </td> <td> <strong>489 S, 109 D, 66 X, 70 X, 71 X</strong> </td> <td> Partially implemented </td> </tr> <tr> <td> <a> Parasoft C/C++test </a> </td> <td> 2022.1 </td> <td> <strong>CERT_C-STR31-a</strong> <strong>CERT_C-STR31-b</strong> <strong>CERT_C-STR31-c</strong> <strong>CERT_C-STR31-d</strong> <strong>CERT_C-STR31-e</strong> </td> <td> Avoid accessing arrays out of bounds Avoid overflow when writing to a buffer Prevent buffer overflows from tainted data Avoid buffer write overflow from tainted data Avoid using unsafe string functions which may cause buffer overflows </td> </tr> <tr> <td> <a> PC-lint Plus </a> </td> <td> 1.4 </td> <td> <strong>421, 498</strong> </td> <td> Partially supported </td> </tr> <tr> <td> <a> Polyspace Bug Finder </a> </td> <td> R2022a </td> <td> <a> CERT C: Rule STR31-C </a> </td> <td> Checks for: Use of dangerous standard functionse of dangerous standard function, missing null in string arrayissing null in string array, buffer overflow from incorrect string format specifieruffer overflow from incorrect string format specifier, destination buffer overflow in string manipulationestination buffer overflow in string manipulation, tainted null or non-null-terminated stringainted null or non-null-terminated string. Rule partially covered. </td> </tr> <tr> <td> <a> PRQA QA-C </a> </td> <td> 9.7 </td> <td> <strong>5009, 5038, 2840, 2841, 2842, 2843, 2845, 2846, 2847, 2848, 2930, 2931, 2932, 2933, 2935, 2936, 2937, 2938</strong> </td> <td> Partially implemented </td> </tr> <tr> <td> <a> PRQA QA-C++ </a> </td> <td> 4.4 </td> <td> <strong>0145, 2840, 2841, 2842, 2843, 2845, 2846, 2847, 2848, 2930, 2931, 2932, 2933, 2935, 2936, 2937, 2938, 5006, 5038</strong> </td> <td> </td> </tr> <tr> <td> <a> PVS-Studio </a> </td> <td> 7.20 </td> <td> <strong>V518<a></a></strong> , <strong>V645<a></a></strong> , <strong>V727<a></a></strong> , <strong><a>V755</a></strong> </td> <td> </td> </tr> <tr> <td> <a> Splint </a> </td> <td> 3.1.1 </td> <td> </td> <td> </td> </tr> <tr> <td> <a> TrustInSoft Analyzer </a> </td> <td> 1.38 </td> <td> <strong>mem_access</strong> </td> <td> Exhaustively verified (see <a> one compliant and one non-compliant example </a> ). </td> </tr> </tbody> </table>
479479
480480
481481
## Related Vulnerabilities
@@ -574,7 +574,7 @@ CWE-193 involves an integer computation error (typically off-by-one), which is o
574574
575575
## Implementation notes
576576
577-
None
577+
The enforcement of this rule does not try to approximate the effects of loops and as such may not find cases where a loop operation on a string fails to null terminate a string (or causes an overflow).
578578
579579
## References
580580

rule_packages/c/Concurrency1.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@
5353
"precision": "very-high",
5454
"severity": "error",
5555
"short_name": "DoNotCallSignalInMultithreadedProgram",
56-
"implementation_scope" : "This implementation does not consider threads created function pointers.",
5756
"tags": [
5857
"correctness",
5958
"concurrency"
60-
]
59+
],
60+
"implementation_scope": {
61+
"description": "This implementation does not consider threads created function pointers."
62+
}
6163
}
6264
],
6365
"title": "Do not call signal() in a multithreaded program"

rule_packages/c/Concurrency3.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"tags": [
1717
"correctness",
1818
"concurrency"
19-
]
19+
],
20+
"implementation_scope": {
21+
"description": "This implementation does not allow for thread synchronization to be performed in subroutines. All synchronization must be performed within the context of the other thread management functions."
22+
}
2023
},
2124
{
2225
"description": "Calling delete on a locked mutex removes protections around shared resources.",
@@ -32,10 +35,7 @@
3235
]
3336
}
3437
],
35-
"title": "Do not destroy a mutex while it is locked",
36-
"implementation_scope": {
37-
"description": "This implementation does not allow for thread synchronization to be performed in subroutines. All synchronization must be performed within the context of the other thread management functions."
38-
}
38+
"title": "Do not destroy a mutex while it is locked"
3939
},
4040
"CON38-C": {
4141
"properties": {
@@ -53,13 +53,13 @@
5353
"tags": [
5454
"correctness",
5555
"concurrency"
56-
]
56+
],
57+
"implementation_scope": {
58+
"description": "This implementation does not attempt to identify unique condition variables and instead advocates for the usage of `cnd_broadcast`."
59+
}
5760
}
5861
],
59-
"title": "Preserve thread safety and liveness when using condition variables",
60-
"implementation_scope": {
61-
"description": "This implementation does not attempt to identify unique condition variables and instead advocates for the usage of `cnd_broadcast`."
62-
}
62+
"title": "Preserve thread safety and liveness when using condition variables"
6363
},
6464
"CON41-C": {
6565
"properties": {
@@ -76,13 +76,13 @@
7676
"tags": [
7777
"correctness",
7878
"concurrency"
79-
]
79+
],
80+
"implementation_scope": {
81+
"description": "This implementation does not attempt to identify a relationship between the condition variable and the atomic operation."
82+
}
8083
}
8184
],
82-
"title": "Wrap functions that can fail spuriously in a loop",
83-
"implementation_scope": {
84-
"description": "This implementation does not attempt to identify a relationship between the condition variable and the atomic operation."
85-
}
85+
"title": "Wrap functions that can fail spuriously in a loop"
8686
}
8787
}
8888
}

rule_packages/c/Contracts1.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"CERT-C": {
33
"ENV30-C": {
4-
"implementation_scope": {
5-
"description": "None."
6-
},
74
"properties": {
85
"obligation": "rule"
96
},
@@ -23,9 +20,6 @@
2320
"title": "Do not modify the object referenced by the return value of certain functions"
2421
},
2522
"ENV31-C": {
26-
"implementation_scope": {
27-
"description": "The rule is enforced in the context of a single function."
28-
},
2923
"properties": {
3024
"obligation": "rule"
3125
},
@@ -39,7 +33,10 @@
3933
"short_name": "EnvPointerIsInvalidAfterCertainOperations",
4034
"tags": [
4135
"correctness"
42-
]
36+
],
37+
"implementation_scope": {
38+
"description": "The rule is enforced in the context of a single function."
39+
}
4340
}
4441
],
4542
"title": "Do not rely on an environment pointer following an operation that may invalidate it"

0 commit comments

Comments
 (0)