Skip to content

Commit e4be606

Browse files
committed
Merge branch 'main' into lcartey/floating-types
2 parents a44af85 + dc8df30 commit e4be606

File tree

50 files changed

+2326
-57
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2326
-57
lines changed

.vscode/tasks.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@
236236
"Lambdas",
237237
"Language1",
238238
"Language2",
239+
"Language3",
239240
"Literals",
240241
"Loops",
241242
"Macros",

c/cert/src/rules/ERR32-C/DoNotRelyOnIndeterminateValuesOfErrno.ql

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,9 @@
1313
import cpp
1414
import codingstandards.c.cert
1515
import codingstandards.c.Errno
16+
import codingstandards.c.Signal
1617
import semmle.code.cpp.controlflow.Guards
1718

18-
/**
19-
* A call to function `signal`
20-
*/
21-
class SignalCall extends FunctionCall {
22-
SignalCall() { this.getTarget().hasGlobalName("signal") }
23-
}
24-
25-
/**
26-
* A call to `abort` or `_Exit`
27-
*/
28-
class AbortCall extends FunctionCall {
29-
AbortCall() { this.getTarget().hasGlobalName(["abort", "_Exit"]) }
30-
}
3119

3220
/**
3321
* A check on `signal` call return value
@@ -47,22 +35,16 @@ class SignalCheckOperation extends EqualityOperation, GuardCondition {
4735
)
4836
}
4937

50-
BasicBlock getCheckedSuccessor() {
51-
result != errorSuccessor and result = this.getASuccessor()
52-
}
38+
BasicBlock getCheckedSuccessor() { result != errorSuccessor and result = this.getASuccessor() }
5339

5440
BasicBlock getErrorSuccessor() { result = errorSuccessor }
5541
}
5642

5743
/**
5844
* Models signal handlers that call signal() and return
5945
*/
60-
class SignalCallingHandler extends Function {
61-
SignalCall registration;
62-
46+
class SignalCallingHandler extends SignalHandler {
6347
SignalCallingHandler() {
64-
// is a signal handler
65-
this = registration.getArgument(1).(FunctionAccess).getTarget() and
6648
// calls signal() on the handled signal
6749
exists(SignalCall sCall |
6850
sCall.getEnclosingFunction() = this and
@@ -75,8 +57,6 @@ class SignalCallingHandler extends Function {
7557
)
7658
)
7759
}
78-
79-
SignalCall getCall() { result = registration }
8060
}
8161

8262
/**
@@ -100,7 +80,7 @@ where
10080
not isExcluded(errno, Contracts5Package::doNotRelyOnIndeterminateValuesOfErrnoQuery()) and
10181
exists(SignalCallingHandler handler |
10282
// errno read after the handler returns
103-
handler.getCall() = signal
83+
handler.getRegistration() = signal
10484
or
10585
// errno read inside the handler
10686
signal.getEnclosingFunction() = handler

0 commit comments

Comments
 (0)