From 0f58539030e436449f79189b6edab17d7479796e Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Sat, 8 Aug 2015 15:53:03 -0700 Subject: Fix BZ #17905 --- catgets/tst-catgets.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'catgets/tst-catgets.c') diff --git a/catgets/tst-catgets.c b/catgets/tst-catgets.c index a0a408936b..140de722c8 100644 --- a/catgets/tst-catgets.c +++ b/catgets/tst-catgets.c @@ -1,7 +1,10 @@ +#include #include #include #include +#include #include +#include static const char *msgs[] = @@ -12,6 +15,33 @@ static const char *msgs[] = }; #define nmsgs (sizeof (msgs) / sizeof (msgs[0])) + +/* Test for unbounded alloca. */ +static int +do_bz17905 (void) +{ + char *buf; + struct rlimit rl; + nl_catd result; + + const int sz = 1024 * 1024; + + getrlimit (RLIMIT_STACK, &rl); + rl.rlim_cur = sz; + setrlimit (RLIMIT_STACK, &rl); + + buf = malloc (sz + 1); + memset (buf, 'A', sz); + buf[sz] = '\0'; + setenv ("NLSPATH", buf, 1); + + result = catopen (buf, NL_CAT_LOCALE); + assert (result == (nl_catd) -1); + + free (buf); + return 0; +} + #define ROUNDS 5 static int @@ -62,6 +92,7 @@ do_test (void) } } + result += do_bz17905 (); return result; } -- cgit v1.2.3