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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Fix crash in regcomp


The pattern "(\\b){0}" causes regcomp to crash.

Andreas.

2004-11-10  Andreas Schwab  <schwab@suse.de>

	* posix/regcomp.c (calc_eclosure_iter): Handle empty node set.
	* posix/bug-regex13.c: Test this.

--- posix/bug-regex13.c.~1.4.~	2003-12-22 07:45:54.000000000 +0100
+++ posix/bug-regex13.c	2004-11-10 01:09:32.919431378 +0100
@@ -61,6 +61,8 @@ static struct
   {RE_SYNTAX_POSIX_EXTENDED, "ab{0}+c", "ac", 0},
   {RE_SYNTAX_POSIX_EXTENDED, "ab{0}+c", "abc", -1},
   {RE_SYNTAX_POSIX_EXTENDED, "ab{0}+c", "abbc", -1},
+  /* This used to crash.  */
+  {RE_SYNTAX_POSIX_EXTENDED, "(\\b){0}", "a", 0},
 };
 
 int
--- posix/regcomp.c.~1.83.~	2004-11-09 23:20:39.000000000 +0100
+++ posix/regcomp.c	2004-11-10 01:10:08.968244251 +0100
@@ -1602,7 +1602,8 @@ calc_eclosure_iter (new_set, dfa, node, 
 		? dfa->nodes[node].opr.ctx_type : 0);
   /* If the current node has constraints, duplicate all nodes.
      Since they must inherit the constraints.  */
-  if (constraint && !dfa->nodes[dfa->edests[node].elems[0]].duplicated)
+  if (constraint && dfa->edests[node].nelem != 0
+      && !dfa->nodes[dfa->edests[node].elems[0]].duplicated)
     {
       int org_node, cur_node;
       org_node = cur_node = node;

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, MaxfeldstraÃe 5, 90409 NÃrnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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