public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* Fix crash in regcomp
@ 2004-11-10  0:38 Andreas Schwab
  0 siblings, 0 replies; only message in thread
From: Andreas Schwab @ 2004-11-10  0:38 UTC (permalink / raw)
  To: libc-hacker

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."

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-11-10  0:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-10  0:38 Fix crash in regcomp Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).