Ask a Question related to PHP Development, Design and Development.
-
ilya at lebedev dot net #1
#25754 [NEW]: preg_replace and preg_replace_callback are crash on long matches
From: ilya at lebedev dot net
Operating system: Win32
PHP version: 4CVS-2003-10-04 (stable)
PHP Bug Type: Reproducible crash
Bug description: preg_replace and preg_replace_callback are crash on long matches
Description:
------------
Regular expression from the J.Friedl's "Mastering regular expressions"
book that matches pair html tags:
#<tag([^>]*)>(((?!</?tag(?:[^>]*)>).)*)</tag>#si
When between <tag> and </tag> are more then 2100 bytes (symbols), Apache
crashes.
Same happens without "s" modifier, if string has no "newline" codes.
Reproduce code:
---------------
===
preg_replace("#<tag([^>]*)>(((?!</?tag(?:[^>]*)>).)*)</tag>#si","","<tag>
2200 symbols</tag>");
===
or
===
function callback (&$m) { return "";};
preg_replace_callback
("#<tag([^>]*)>(((?!</?tag(?:[^>]*)>).)*)</tag>#si","callback","<tag> 2200
symbols </tag>");
===
Expected result:
----------------
Match blocks bigger then 2100 symbols long.
Actual result:
--------------
With more then 2100 sybmols between tags Apache crashes.
--
Edit bug report at [url]http://bugs.php.net/?id=25754&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=25754&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=25754&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=25754&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=25754&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=25754&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=25754&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=25754&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=25754&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=25754&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=25754&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=25754&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=25754&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=25754&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=25754&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=25754&r=gnused[/url]
Floating point limitations: [url]http://bugs.php.net/fix.php?id=25754&r=float[/url]
ilya at lebedev dot net Guest
-
#39951 [NEW]: PCRE Failed for Long Matches (Less Than MATCH_LIMIT)
From: imacat at mail dot imacat dot idv dot tw Operating system: Linux 2.6.16.29 PHP version: 5.2.0 PHP Bug Type: PCRE... -
#39951 [Opn]: PCRE Failed for Long Matches (Less Than MATCH_LIMIT)
ID: 39951 User updated by: imacat at mail dot imacat dot idv dot tw Reported By: imacat at mail dot imacat dot idv dot tw... -
#25394 [Com]: Segfault and Crash on long scripts.
ID: 25394 Comment by: phpnet at baskettcase dot com Reported By: mark dot meredith at shaw dot ca Status: Bogus... -
#25394 [Bgs->Opn]: Segfault and Crash on long scripts.
ID: 25394 User updated by: mark dot meredith at shaw dot ca Reported By: mark dot meredith at shaw dot ca -Status: ... -
#25394 [Opn->Bgs]: Segfault and Crash on long scripts.
ID: 25394 Updated by: sniper@php.net Reported By: mark dot meredith at shaw dot ca -Status: Open +Status: ... -



Reply With Quote


