From: johnston dot joshua at gmail dot com
Operating system: OS X and OpenSuSE
PHP version: 5.2.6
PHP Bug Type: PCRE related
Bug description: preg_match fails with Segmentation Fault on capturing
subpattern
Description:
------------
When running a preg_match with a capturing subpattern against large input,
php crashes with a Segmentation Fault
I tested this on OS X and OpenSuSE, same result
OS X:~$ php -v
PHP 5.2.6 (cli) (built: Jul 15 2008 12:18:21)
OpenSuSE:~# php -v
PHP 4.4.7 (cgi) (built: May 12 2008 10:19:51)
Reproduce code:
---------------
<?php
preg_match("/http:\/\/(.)+\.ru/i", str_repeat("http://google.ru", 2000));
?>
Expected result:
----------------
PHP should handle the error or something other than letting PCRE crash php
Actual result:
--------------
jjohnston:~$ php -r 'preg_match("/http:\/\/(.)+\.ru/i",
str_repeat("http://google.ru", 2000));'
Segmentation fault
--
Edit bug report at http://bugs.php.net/?id=45735&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45735&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45735&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45735&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45735&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45735&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45735&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45735&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45735&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45735&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45735&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45735&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45735&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45735&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45735&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45735&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45735&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45735&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45735&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45735&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45735&r=mysqlcfg