From: php at koterov dot ru
Operating system: Windows XP
PHP version: 4.4.0
PHP Bug Type: Reproducible crash
Bug description: preg_replace(): {}-expresion overflow
Description:
------------
PCRE /X{1,Y}/ for large Y (near 1000) does not work for some X on Windows
(apache 1.3+mod_php 4.4.0 or 4.3.10). In Unix (Linux) - everything is
fine. Maybe stack overflow?
Reproduce code:
---------------
<?
define('MAXLEN', 1000);
$text = str_repeat('a', 10000);
$text = preg_replace('/ ( (?: [^<] | < [^>]* >){1,'.MAXLEN.'}) .* /xs',
'$1', $text);
die('ok');
?>
Expected result:
----------------
ok
Actual result:
--------------
nothing (php exits, but no windows GPF)
--
Edit bug report at http://bugs.php.net/?id=34695&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34695&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34695&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34695&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34695&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34695&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34695&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34695&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34695&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34695&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34695&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34695&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34695&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34695&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34695&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34695&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34695&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34695&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34695&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34695&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34695&r=mysqlcfg