Skip to content

Commit

Permalink
On OCaml 5, use SA_ONSTACK to avoid corrupting memory
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Jun 21, 2023
1 parent cc05e2b commit 890b19a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/unix/lwt_unix_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,11 @@ CAMLprim value lwt_unix_set_signal(value val_signum, value val_notification) {
}
#else
sa.sa_handler = handle_signal;
#if OCAML_VERSION >= 50000
sa.sa_flags = SA_ONSTACK;
#else
sa.sa_flags = 0;
#endif
sigemptyset(&sa.sa_mask);
if (sigaction(signum, &sa, NULL) == -1) {
signal_notifications[signum] = -1;
Expand Down

0 comments on commit 890b19a

Please sign in to comment.