From: novicky at aarongroup dot cz
Operating system: win32
PHP version: 4.3.6
PHP Bug Type: PCRE related
Bug description: stack overflow
Description:
------------
Stack overflow during preg_match() on complex regular expressions used for
long data.
As written in pcre.c ...
/***************************************************************************
****************************************************************************
RECURSION IN THE match() FUNCTION
The match() function is highly recursive. Some regular expressions can
cause
it to recurse thousands of times. I was writing for Unix, so I just let
it
call itself recursively. This uses the stack for saving everything that
has
to be saved for a recursive call. On Unix, the stack can be large, and
this
works fine.
It turns out that on non-Unix systems there are problems with programs
that
use a lot of stack. (This despite the fact that every last chip has
oodles
of memory these days, and techniques for extending the stack have been
known
for decades.) So....
There is a fudge, triggered by defining NO_RECURSE, which avoids
recursive
calls by keeping local variables that need to be preserved in blocks of
memory
obtained from malloc instead instead of on the stack. Macros are used to
achieve this so that the actual code doesn't look very different to what
it
always used to.
****************************************************************************
***************************************************************************/
Thus NO_RECURSE should be set in win32 compiler oprions.
--
Edit bug report at http://bugs.php.net/?id=28317&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28317&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28317&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28317&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28317&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28317&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28317&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28317&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28317&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28317&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28317&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28317&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28317&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28317&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28317&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28317&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28317&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28317&r=float