#47520 [Bgs]: PHP segfaulted in preg_replace on processing long string
| From: | pahan at hubbitus dot spb dot su | Date: | Tue, 03 Mar 2009 13:15:17 +0000 |
| Subject: | #47520 [Bgs]: PHP segfaulted in preg_replace on processing long string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134370@lists.php.net to get a copy of this message | ||
ID: 47520
User updated by: pahan at hubbitus dot spb dot su
Reported By: pahan at hubbitus dot spb dot su
Status: Bogus
Bug Type: PCRE related
Operating System: Linux
PHP Version: 5.3.0beta1
New Comment:
Problem in pcre library is a problem of pcre library.
BUT segmentation fault of PHP is a bug PHP itself in any case!!!
I can understand what it may be very hard to fix, but completely do not
understand why you mark it as Bogus!
Previous Comments:
------------------------------------------------------------------------
[2009-03-03 01:40:03] iliaa@php.net
There is not much we can do about recursion limits other then suggest
the lowering of the pcre.recursion_limit setting. The basic problem is
that PCRE library (not PHP) is eating up the system stack during
recursion and subsequently crashes when it runs out of room.
This is not a PHP bug.
------------------------------------------------------------------------
[2009-03-02 10:09:28] phpwnd at gmail dot com
I forgot to add that in my case, lowering the value the
pcre.recursion_limit INI setting make preg_* functions fail instead of
making PHP segfault.
------------------------------------------------------------------------
[2009-03-02 10:01:52] phpwnd at gmail dot com
I'd like to add that you don't need such a complicated test case, you
can make preg_* segfault with just something like:
$str = str_repeat(' ', 2490);
preg_match('#(.)+#', $str);
On my computer, a 2490-chars string is long enough to make it segfaults
everytime. For some reason, 2489 chars will make it segfault only 1 out
of 5 runs and 2480 chars are perfectly fine. If I replace the regexp
with more capturing parenthesis such as #((.))+# that limit drops to
1500-or-so and that number decreases as the number of parenthesis
increases. Using non-capturing patterns such as #(?:.)+# doubles that
number.
Obviously, the bug is related to capturing patterns repetition,
assuming we're experiencing the same bug. I'll try to find a place where
to host a core dump.
------------------------------------------------------------------------
[2009-02-28 09:00:02] pahan at hubbitus dot spb dot su
Very apologize for mistake.
I'm fix rights now, please recheck.
------------------------------------------------------------------------
[2009-02-28 01:19:21] felipe@php.net
I cannot download the coredump file: "You don't have permission to
access /_temp/php-pcre-bug/2/core.10135 on this server."
Can you give us a backtrace?
------------------------------------------------------------------------
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
http://bugs.php.net/47520
--
Edit this bug report at http://bugs.php.net/?id=47520&edit=1