Edit report at https://bugs.php.net/bug.php?id=36463&edit=1

 ID:                 36463
 Comment by:         nicolas at toniazzi dot net
 Reported by:        sthapa at site5 dot com
 Summary:            preg_match crashes
 Status:             Bogus
 Type:               Bug
 Package:            PCRE related
 Operating System:   Linux
 PHP Version:        5.1.2
 Block user comment: N
 Private report:     N

 New Comment:

I reduced the test case to this:
$count  = 203;
$string = str_repeat("a", $count);
echo preg_match('/^(a)+$/', $s, $m);

Crashes for count > 202 on Windows 7, apache 2.2 and php 5.3.8 (all 64 bits).
But it's working with the CLI, using the same php.ini.

Adding the pcre.* directives in php.ini didn't help.


Previous Comments:
------------------------------------------------------------------------
[2010-01-20 23:22:24] ras...@php.net

Ah, I thought you meant the count=500 case crashed.  The higher numbers is 
simply overflowing libpcre's stack and you haven't set a sane limit.  This is 
not a bug.  This is a limitation of the pcre library and a configuration issue 
on your part.  Add this to your php.ini:

pcre.backtrack_limit = 10000
pcre.recursion_limit = 10000

And I bet your crash will go away.

------------------------------------------------------------------------
[2010-01-20 23:08:12] liviu dot mirea at gmail dot com

On CentOS 5.4, PHP 5.3.1, Apache/2.2.3:

With "$count = 5947;" it works. With "$count = 5948;" or higher it silently 
crashes. Apache error log: "[Thu Jan 21 01:02:15 2010] [notice] child pid 18136 
exit signal Segmentation fault (11)"

rasmus at php at net, try giving it larger values.

------------------------------------------------------------------------
[2010-01-20 22:47:52] ras...@php.net

Works fine on Linux

------------------------------------------------------------------------
[2010-01-20 22:44:30] liviu dot mirea at gmail dot com

I tested it again and it crashed on my current configuration: PHP 5.3.1, 
Apache/2.2.14 (Win32), Windows 7 (64 bit)

------------------------------------------------------------------------
[2010-01-19 16:06:51] paj...@php.net

Which web server? Apache?

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=36463


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=36463&edit=1

Reply via email to