Skip to content

Commit a678379

Browse files
committed
quewry
1 parent aa02fd2 commit a678379

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
}

0 commit comments

Comments
 (0)