This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug regex/611] regex with a long character sequence requires huge stack space
- From: "bonzini at gnu dot org" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 17 Dec 2004 08:37:49 -0000
- Subject: [Bug regex/611] regex with a long character sequence requires huge stack space
- References: <20041217083412.611.bonzini@gnu.org>
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
------- Additional Comments From bonzini at gnu dot org 2004-12-17 08:37 -------
Created an attachment (id=312)
--> (http://sources.redhat.com/bugzilla/attachment.cgi?id=312&action=view)
patch fixing this bug
This patch is a big one that completely separates parse tree creation and NFA
construction. It was posted on
http://sources.redhat.com/ml/libc-alpha/2004-12/msg00045.html first; this
version is identical except that it includes the bug 605 changes on which the
libc-alpha patch is based.
Improvements in this patch include:
1) It eliminates recursion on CONCAT nodes from regcomp.c; with an 8 MB
stack,
perl -e "print 's/' . ('a' x 300000) . '//'" | sed -f -
segfaults in analyze_tree without the patch. Of course with a lower
stack size it takes much shorter regexes to trigger the bug, and anyway
this is not nice behavior (ok, regex is a memory hog but at least it
usually gives REG_ESPACE). I don't have the time to fix this in a
different way -- as I said, I am not doing this just for fun.
2) It provides a useful infrastructure while actually removing code from
regcomp.c (the patched file is ~60 lines shorter). This infrastructure
can help in turn removing code from regexec.c and making it faster (see
for example the star-normal form mentioned in libc-alpha).
--
http://sources.redhat.com/bugzilla/show_bug.cgi?id=611
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.