#45735 [NEW]: preg_match fails with Segmentation Fault on capturing subpattern
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
Thread (18 messages)
- johnston dot joshua at gmail dot com
- jani@php.net#45735 [Opn->Ver]: preg_match fails with Segmentation Fault on capturing subpattern
- jani@php.net#45735 [Ver]: preg_match fails with Segmentation Fault on capturing subpattern
- jani@php.net#45735 [Ver->Fbk]: preg_match fails with Segmentation Fault on capturing subpattern
- johnston dot joshua at gmail dot com#45735 [Fbk->Opn]: preg_match fails with Segmentation Fault on capturing subpattern
- felipe@php.net#45735 [Opn]: preg_match fails with Segmentation Fault on capturing subpattern
- felipe@php.net#45735 [Opn->Bgs]: preg_match fails with Segmentation Fault on capturing subpattern
- johnston dot joshua at gmail dot com#45735 [Bgs]: preg_match fails with Segmentation Fault on capturing subpattern
- derick@php.net#45735 [Bgs]: preg_match fails with Segmentation Fault on capturing subpattern
- lbarnaud@php.net#45735 [Bgs]: preg_match fails with Segmentation Fault on capturing subpattern
- johnston dot joshua at gmail dot com#45735 [Bgs]: preg_match fails with Segmentation Fault on capturing subpattern
- josiecki at silvercube dot plBug #45735 [Com]: preg_match fails with Segmentation Fault on capturing subpattern
- vojtech dot kurka at gmail dot comBug #45735 [Com]: preg_match fails with Segmentation Fault on capturing subpattern
- michael at writhem dot comBug #45735 [Com]: preg_match fails with Segmentation Fault on capturing subpattern
- josh dot adell at gmail dot comBug #45735 [Com]: preg_match fails with Segmentation Fault on capturing subpattern
- johnston dot joshua at gmail dot comBug #45735 [Com]: preg_match fails with Segmentation Fault on capturing subpattern
- rasmus@php.netBug #45735 [Nab]: preg_match fails with Segmentation Fault on capturing subpattern
- php at mandark dot frBug #45735 [Com]: preg_match fails with Segmentation Fault on capturing subpattern