From: Steve Peters Date: Thu, 9 Mar 2006 16:03:21 +0000 (+0000) Subject: croak in POSIX::sigaction() when passed a negative signal instead X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=516d25e8e8c09c6c60bf2f46703fc4d5add0f5fb;p=p5sagit%2Fp5-mst-13.2.git croak in POSIX::sigaction() when passed a negative signal instead dumping core. p4raw-id: //depot/perl@27440 --- diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 730e7e0..50f3a74 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1260,6 +1260,10 @@ sigaction(sig, optaction, oldaction = 0) SV** svp; SV** sigsvp; + if (sig < 0) { + croak("Negative signals are not allowed"); + } + if (sig == 0 && SvPOK(ST(0))) { const char *s = SvPVX_const(ST(0)); int i = whichsig(s); diff --git a/ext/POSIX/t/sigaction.t b/ext/POSIX/t/sigaction.t index 813960a..c33b732 100644 --- a/ext/POSIX/t/sigaction.t +++ b/ext/POSIX/t/sigaction.t @@ -205,3 +205,6 @@ SKIP: { kill 'HUP', $$; } +eval { sigaction(-999, "foo"); }; +like($@, qr/Negative signals/, + "Prevent negative signals instead of core dumping");