Bug #53635 [Opn->Bgs]: Long strings causes PCRE to seg fault
| From: | felipe@php.net | Date: | Sat, 01 Jan 2011 01:36:57 +0000 |
| Subject: | Bug #53635 [Opn->Bgs]: Long strings causes PCRE to seg fault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-157467@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53635&edit=1
ID: 53635
Updated by: felipe@php.net
Reported by: simon at simon dot geek dot nz
Summary: Long strings causes PCRE to seg fault
-Status: Open
+Status: Bogus
Type: Bug
Package: PCRE related
Operating System: Mac OS 10.6.5
PHP Version: 5.3SVN-2011-01-01 (SVN)
Block user comment: N
Private report: N
New Comment:
This is a known behavior from PCRE.
See bug #51663
Previous Comments:
------------------------------------------------------------------------
[2011-01-01 02:34:03] simon at simon dot geek dot nz
If needed, I can upload a script with a much longer string.
------------------------------------------------------------------------
[2011-01-01 02:18:19] simon at simon dot geek dot nz
Description:
------------
Given certain regexs and large strings, preg_match() will recurse around
9200
times and then seg fault. The shortest length for the string to match
that I
managed to get that reproduce the crash each time was 4596 characters.
Different
versions of the PCRE library can handle longer strings, but all versions
I tested
crashed at 7000.
I ran this solely through the CLI.
The configure command I used was: ./configure --without-pear
"--prefix=$PWD" --
enable-debug for both SVN revision 306937 and PHP 5.3.4. The version of
PHP
(5.3.3) that is included in Mac OS 10.6.5 and is linked against external
PCRE
libraries also seg faulted.
The regex I was using is #^"((\\"|[^"])+)#. Removing \\"| prevents the
seg fault
from occurring.
Test script:
---------------
http://simon.geek.nz/assets/text/a
Expected result:
----------------
Either a 0 or a 1 to be returned.
Actual result:
--------------
PHP segfaulted with a rather large (6.1 MB) backtrace.
http://simon.geek.nz/assets/text/9
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=53635&edit=1