As per C17: (paraphrasing)
"the behavior is undefined if \<snip>, or the signal handler calls any function in the standard library other than abort, _Exit, quick_exit, atomic_is_lock_free, signal and functions in <stdatomic.h>"
So this program invokes UB when tried to end with Ctrl+c (SIGINT):
@rootkea UBSan does not detect all types of UB and in particular, not calling unsafe functions in signal handlers. You may be interested in sighandlercheck.
Hello!
As per C17: (paraphrasing) "the behavior is undefined if \<snip>, or the signal handler calls any function in the standard library other than
abort
,_Exit
,quick_exit
,atomic_is_lock_free
,signal
and functions in<stdatomic.h>
"So this program invokes UB when tried to end with
Ctrl+c
(SIGINT
):But UBSan doesn't report this undefined behavior.