This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Regex failure


Hi,

From: "Bonzini" <bonzini@gnu.org>

> This script fails with the CVS version of regex (checked out yesterday
> evening, CET), when the input is 11 (tested with my development sources for
> GNU sed will-be-4.0, fails with an assertion failure in regexec).

Thank you for reporting.

Attached patches are a test case and a fix.
How about them?

Thanks,
--
Isamu Hasegawa
IBM Japan, Ltd.


2002-10-17  Isamu Hasegawa  <isamu@yamato.ibm.com>

	* posix/bug-regex11.c: Add a test case for the bug reported by
	Paolo Bonzini <bonzini@gnu.org>.
	* posix/regexec.c (sift_states_bkref): Use correct destination of
	the back reference.


diff -urNp libc-/posix/bug-regex11.c libc/posix/bug-regex11.c
--- libc-/posix/bug-regex11.c	2002-10-17 19:53:31.000000000 +0900
+++ libc/posix/bug-regex11.c	2002-10-17 20:00:29.000000000 +0900
@@ -30,7 +30,7 @@ struct
   const char *pattern;
   const char *string;
   int flags, nmatch;
-  regmatch_t rm[4];
+  regmatch_t rm[5];
 } tests[] = {
   /* Test for newline handling in regex.  */
   { "[^~]*~", "\nx~y", 0, 2, { { 0, 3 }, { -1, -1 } } },
@@ -38,14 +38,17 @@ struct
   { ".*|\\([KIO]\\)\\([^|]*\\).*|?[KIO]", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
     { { 0, 21 }, { 15, 16 }, { 16, 18 } } },
   { ".*|\\([KIO]\\)\\([^|]*\\).*|?\\1", "10~.~|P|K0|I10|O16|?KSb", 0, 3,
-    { { 0, 21 }, { 8, 9 }, { 9, 10 } } }
+    { { 0, 21 }, { 8, 9 }, { 9, 10 } } },
+  { "^\\(a*\\)\\1\\{9\\}\\(a\\{0,9\\}\\)\\([0-9]*;.*[^a]\\2\\([0-9]\\)\\)",
+    "a1;;0a1aa2aaa3aaaa4aaaaa5aaaaaa6aaaaaaa7aaaaaaaa8aaaaaaaaa9aa2aa1a0", 0,
+    5, { { 0, 67 }, { 0, 0 }, { 0, 1 }, { 1, 67 }, { 66, 67 } } }
 };
 
 int
 main (void)
 {
   regex_t re;
-  regmatch_t rm[4];
+  regmatch_t rm[5];
   size_t i;
   int n, ret = 0;
 
diff -urNp libc-/posix/regexec.c libc/posix/regexec.c
--- libc-/posix/regexec.c	2002-10-17 19:49:10.000000000 +0900
+++ libc/posix/regexec.c	2002-10-17 19:51:01.000000000 +0900
@@ -1945,7 +1945,7 @@ sift_states_bkref (preg, mctx, sctx, str
                 continue;
 
               if (check_dst_limits (dfa, &sctx->limits, mctx, node,
-                                    str_idx, dfa->nexts[node], to_idx))
+                                    str_idx, dst_node, to_idx))
                 continue;
               if (sctx->check_subexp == dfa->nodes[node].opr.idx)
                 {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]