]> sourceware.org Git - glibc.git/commitdiff
2002-12-13 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@gnu.org>
Fri, 13 Dec 2002 21:32:03 +0000 (21:32 +0000)
committerRoland McGrath <roland@gnu.org>
Fri, 13 Dec 2002 21:32:03 +0000 (21:32 +0000)
* posix/bug-regex15.c: New file.
* posix/Makefile (tests): Add it.

posix/Makefile
posix/bug-regex15.c [new file with mode: 0644]

index 2ed01983932204370df66d57ea0e33a6c0a7fbd3..90129d76854963857eef3d37e9cd9520dc22a699 100644 (file)
@@ -75,7 +75,7 @@ tests         := tstgetopt testfnm runtests runptests      \
                   tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
                   tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
                   bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
-                  bug-regex13 bug-regex14
+                  bug-regex13 bug-regex14 bug-regex15
 ifeq (yes,$(build-shared))
 test-srcs      := globtest
 tests           += wordexp-test tst-exec tst-spawn
diff --git a/posix/bug-regex15.c b/posix/bug-regex15.c
new file mode 100644 (file)
index 0000000..8f6d3cc
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test for memory/CPU leak in regcomp.  */
+
+#include <error.h>
+#include <sys/types.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define TEST_DATA_LIMIT (32 << 20)
+
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
+
+static int
+do_test (void)
+{
+  regex_t re;
+  int reerr;
+
+  reerr = regcomp (&re, "^6?3?[25]?5?[14]*[25]*[69]*+[58]*87?4?$",
+                  REG_EXTENDED | REG_NOSUB);
+  if (reerr != 0)
+    {
+      char buf[100];
+      regerror (reerr, &re, buf, sizeof buf);
+      printf ("regerror %s\n", buf);
+      return 1;
+    }
+
+  return 0;
+}
This page took 0.04149 seconds and 5 git commands to generate.