ID: 45735 User updated by: johnston dot joshua at gmail dot com Reported By: johnston dot joshua at gmail dot com -Status: Feedback +Status: Open Bug Type: PCRE related Operating System: * PHP Version: 5.2CVS, 5.3CVS, 6CVS (2008-08-06) New Comment:
In my case the parens were unnecessary so I removed them which stopped the Seg Fault. Is there a way to handle this error from inside php? If I set pcre.backtrack_limit to any other value will it always seg fault if it is too low? Previous Comments: ------------------------------------------------------------------------ [2008-08-06 16:38:30] [EMAIL PROTECTED] Setting pcre.backtrack_limit = 10000 prevents the crash for me. ------------------------------------------------------------------------ [2008-08-06 16:36:27] [EMAIL PROTECTED] ==18470== Stack overflow in thread 1: can't grow stack to 0x7FE601FA8 ==18470== ==18470== Process terminating with default action of signal 11 (SIGSEGV) ==18470== Access not within mapped region at address 0x7FE601FA8 ==18470== at 0x4358C0: match (pcre_exec.c:403) ==18470== Stack overflow in thread 1: can't grow stack to 0x7FE601EC8 ------------------------------------------------------------------------ [2008-08-06 15:22:20] johnston dot joshua at gmail dot com 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 this bug report at http://bugs.php.net/?id=45735&edit=1