#46551 [Com]: preg_replace crash the httpd process
| From: | donquixote dot phplist at googlemail dot com | Date: | Mon, 28 Sep 2009 05:22:55 +0000 |
| Subject: | #46551 [Com]: preg_replace crash the httpd process | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-142975@lists.php.net to get a copy of this message | ||
ID: 46551
Comment by: donquixote dot phplist at googlemail dot com
Reported By: johnpupu at gmail dot com
Status: No Feedback
Bug Type: PCRE related
Operating System: FreeBSD 7.0-RELEASE-p4
PHP Version: 5.2.6
New Comment:
I found a regex / text combination that causes my apache to crash /
restart with preg_replace. The example is a reduced version of Drupal's
CSS compression regex.
The regex is not overly complex, and the text is not overly long.
Reproducing this depends on system configuration: On my webspace it
does not crash.
But, on my localhost it makes a reproducible crash. Removing a few
letters in the regexped text (no matter which) makes the bug not
happen.
More info in the linked file.
standalone "evil script" at
http://drupal.org/files/issues/test.php__1.txt
(rename to *.php)
posted here
http://drupal.org/node/444228#comment-2089300
Previous Comments:
------------------------------------------------------------------------
[2009-09-28 05:22:03] donquixote dot phplist at googlemail dot com
I found a regex / text combination that causes my apache to crash /
restart with preg_replace. The example is a reduced version of Drupal's
CSS compression regex.
The regex is not overly complex, and the text is not overly long.
Reproducing this depends on system configuration: On my webspace it
does not crash.
But, on my localhost it makes a reproducible crash. Removing a few
letters in the regexped text (no matter which) makes the bug not
happen.
More info in the linked file.
standalone "evil script" at
http://drupal.org/files/issues/test.php__1.txt
(rename to *.php)
posted here
http://drupal.org/node/444228#comment-2089300
------------------------------------------------------------------------
[2008-11-20 01:00:01] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
------------------------------------------------------------------------
[2008-11-12 13:09:09] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
And also, you need to provide the full configure line you used to
compile PHP. If you're using anything but bundled PCRE lib -> bogus.
------------------------------------------------------------------------
[2008-11-12 06:11:26] johnpupu at gmail dot com
Description:
------------
if i use preg_replace function , my system log will show
Nov 12 13:41:31 mail kernel: pid 51185 (httpd), uid 80: exited on
signal 4
i try to use ereg_replace, mb_ereg_replace function , it works .
so I think it's preg_replace bugs.
$sql = preg_replace("/'(\\'|\\{2}|[^'])*'/", '', $sql)
sql statement is
INSERT IGNORE INTO bb_posts_text (post_id, post_text) VALUES (
'117766',
'©I!!·Q¨ì¤@¦~«e·í§L«e¤]«Ü±`¤W¨Ómml¸ò¤j®a¥æ¬y¤À¨É·Ó¤ù
¦ý¤§«á´N·í§L¤F ¨S¤°»ò®É¶¡ À³¸Ó»¡¤]¨S¾÷·|ª±¨ì·Ó¹³¤â¾÷
¨º®É´N¥u¦n¦bx¤¤®³nokia ªºE60´¼¼z¤â¾÷¹L¹L°®Å}
²×©óªü ³Q§Ú¼õ¨ì°h¥î¤F...©Ò¥H©O·íµM´N¸ò
¦n´X¦ì°h¥îªº§Ì¥S¤@°_¥X¥hªáªFª±Ó´X¤Ñ
³oª±ªº´X¤Ñ´Á¶¡°£¤F¥Î¬Û¾÷©ç·Ó¥~...¦]¬°¤â¾÷¥Ø«e®³ªº¬Oiphone
©Ò¥H¤]ÀH¤â®³¥X¨Ó¶Ã©ç....ÁöµM¤j®a³£ª¾¹Diphone±j¶µ¤£¦b¬Û¾÷
¬Æ¦Ü´¶¹M¦³¤H·|ı±o¥¦ªº©ç·Ó«ÜÄê...¦ý¸g¹L³o¦¸iphone¬Û¾÷³§Ú¾Þ¤F4¤Ñ¤§«á
¦ý§Ú¯uªºÄ±±o°Õ ¥H¥Lªº200¸Uµ¥¯Å µL¦Û°Ê¹ïµJµ¥¯Å¨Ó»¡
³o¤ä©ç·Ó§Úı±o¥i¥H¦b³o¨Çµ¥¯Åªº¤â¾÷¸ÌºâÆZ«e±ªº¤F
(ºâ¬Oȱo¹Å³\©Ô..¦Ü¤Ö¥H¥L©ç·Ó³W®æ¨Ó¬Ý..¦]¬°¥ý«e¥Î¹LµLaf200¸Uµe¯À©ç'
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46551&edit=1