Undefined behavior when signal handler returns normally from program error
This defect occurs
when a signal handler returns after catching a computational exception signal
SIGFPE, SIGILL, or SIGSEGV.
A signal handler that returns normally from a computational exception is undefined behavior. Even if the handler attempts to fix the error that triggered the signal, the program can behave unexpectedly.
Check the validity of the values of your variables before the computation to avoid using
a signal handler to catch exceptions. If you cannot avoid a handler to catch computation
exception signals, call abort(), quick_exit(), or
_Exit() in the handler to stop the program.
| Group: Programming |
| Language: C | C++ |
| Default: On for handwritten code, off for generated code |
Command-Line Syntax:
SIG_HANDLER_COMP_EXCP_RETURN
|
| Impact: Low |
| CWE ID: 387 |
Find defects (-checkers) | Function called from
signal handler not asynchronous-safe | Function called from
signal handler not asynchronous-safe (strict) | Signal call from within
signal handler