summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2014-11-01 21:00:40 +0000
committerngie <ngie@FreeBSD.org>2014-11-01 21:00:40 +0000
commit54a2fbab7f097d56e0d0d5835e1f4f1140b16d65 (patch)
tree475b484809d3a2b9f42ba1ab52dde3ee66aac5e8 /contrib/netbsd-tests
parent224945e57445d0e8dc6842826796387ba6419d53 (diff)
downloadFreeBSD-src-54a2fbab7f097d56e0d0d5835e1f4f1140b16d65.zip
FreeBSD-src-54a2fbab7f097d56e0d0d5835e1f4f1140b16d65.tar.gz
Expect :snprintf_posarg_error to blow up with a SIGSEGV on !NetBSD OSes
Diffstat (limited to 'contrib/netbsd-tests')
-rw-r--r--contrib/netbsd-tests/lib/libc/stdio/t_printf.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/stdio/t_printf.c b/contrib/netbsd-tests/lib/libc/stdio/t_printf.c
index 95b4b2c..5ef58f2 100644
--- a/contrib/netbsd-tests/lib/libc/stdio/t_printf.c
+++ b/contrib/netbsd-tests/lib/libc/stdio/t_printf.c
@@ -36,6 +36,10 @@
#include <time.h>
#include <stdlib.h>
+#ifndef __NetBSD__
+#include <signal.h>
+#endif
+
ATF_TC(snprintf_c99);
ATF_TC_HEAD(snprintf_c99, tc)
{
@@ -116,6 +120,12 @@ ATF_TC_BODY(snprintf_posarg_error, tc)
{
char s[16], fmt[32];
+#ifndef __NetBSD__
+ atf_tc_expect_signal(SIGSEGV,
+ "some non-NetBSD platforms including FreeBSD don't validate "
+ "negative size; testcase blows up with SIGSEGV");
+#endif
+
snprintf(fmt, sizeof(fmt), "%%%zu$d", SIZE_MAX / sizeof(size_t));
ATF_CHECK(snprintf(s, sizeof(s), fmt, -23) == -1);
OpenPOWER on IntegriCloud