File tree Expand file tree Collapse file tree 4 files changed +81
-0
lines changed Expand file tree Collapse file tree 4 files changed +81
-0
lines changed Original file line number Diff line number Diff line change 1+ # CON31-C: Do not destroy a mutex while it is locked
2+
3+ This query implements the CERT-C rule CON31-C:
4+
5+ > Do not destroy a mutex while it is locked
6+
7+
8+ ## CERT
9+
10+ ** REPLACE THIS BY RUNNING THE SCRIPT ` scripts/help/cert-help-extraction.py ` **
11+
12+ ## Implementation notes
13+
14+ None
15+
16+ ## References
17+
18+ * CERT-C: [ CON31-C: Do not destroy a mutex while it is locked] ( https://wiki.sei.cmu.edu/confluence/display/c )
Original file line number Diff line number Diff line change 1+ /**
2+ * @id c/cert/do-not-allow-a-mutex-to-go-out-of-scope-while-locked
3+ * @name CON31-C: Do not destroy a mutex while it is locked
4+ * @description Allowing a mutex to go out of scope while it is locked removes protections around
5+ * shared resources.
6+ * @kind problem
7+ * @precision high
8+ * @problem.severity error
9+ * @tags external/cert/id/con31-c
10+ * correctness
11+ * concurrency
12+ * external/cert/obligation/rule
13+ */
14+
15+ import cpp
16+ import codingstandards.c.cert
17+ import codingstandards.cpp.rules.donotallowamutextogooutofscopewhilelocked.DoNotAllowAMutexToGoOutOfScopeWhileLocked
18+
19+ class DoNotAllowAMutexToGoOutOfScopeWhileLockedQuery extends DoNotAllowAMutexToGoOutOfScopeWhileLockedSharedQuery {
20+ DoNotAllowAMutexToGoOutOfScopeWhileLockedQuery ( ) {
21+ this = Concurrency3Package:: doNotAllowAMutexToGoOutOfScopeWhileLockedQuery ( )
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ # CON31-C: Do not destroy a mutex while it is locked
2+
3+ This query implements the CERT-C rule CON31-C:
4+
5+ > Do not destroy a mutex while it is locked
6+
7+
8+ ## CERT
9+
10+ ** REPLACE THIS BY RUNNING THE SCRIPT ` scripts/help/cert-help-extraction.py ` **
11+
12+ ## Implementation notes
13+
14+ None
15+
16+ ## References
17+
18+ * CERT-C: [ CON31-C: Do not destroy a mutex while it is locked] ( https://wiki.sei.cmu.edu/confluence/display/c )
Original file line number Diff line number Diff line change 1+ /**
2+ * @id c/cert/do-not-destroy-a-mutex-while-it-is-locked
3+ * @name CON31-C: Do not destroy a mutex while it is locked
4+ * @description Calling delete on a locked mutex removes protections around shared resources.
5+ * @kind problem
6+ * @precision high
7+ * @problem.severity error
8+ * @tags external/cert/id/con31-c
9+ * correctness
10+ * concurrency
11+ * external/cert/obligation/rule
12+ */
13+
14+ import cpp
15+ import codingstandards.c.cert
16+ import codingstandards.cpp.rules.donotdestroyamutexwhileitislocked.DoNotDestroyAMutexWhileItIsLocked
17+
18+ class DoNotDestroyAMutexWhileItIsLockedQuery extends DoNotDestroyAMutexWhileItIsLockedSharedQuery {
19+ DoNotDestroyAMutexWhileItIsLockedQuery ( ) {
20+ this = Concurrency3Package:: doNotDestroyAMutexWhileItIsLockedQuery ( )
21+ }
22+ }
You can’t perform that action at this time.
0 commit comments