#37125 [NEW]: "str_replace" causes system overflow when using regexp's as replace
| From: | realbora at gmx dot de | Date: | Tue, 18 Apr 2006 18:04:41 +0000 |
| Subject: | #37125 [NEW]: "str_replace" causes system overflow when using regexp's as replace | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-95945@lists.php.net to get a copy of this message | ||
From: realbora at gmx dot de
Operating system: windows 2000
PHP version: 5.1.2
PHP Bug Type: *General Issues
Bug description: "str_replace" causes system overflow when using regexp's as replace
Description:
------------
"str_replace" causes buffer overflow when using regexp's as replace!
When using regexp`s as the replacement in "str_replace" a system hangup
can cause.
Not ever, but in general is this the failure.
Reproduce code:
---------------
$regExp=array(":","-","{","}","(",")","~","[","]","#","|");
$sql2=mysql_query('select * from smilies;');
for($i=0;$temp2=mysql_fetch_array($sql2);$i++){
$smilie[$i]=$temp2['smilie'];
for($j=0;$j<=count($regExp);$j++){
$smilie[$i]=str_replace($regExp[$j],"\\"."\\".$regExp[$j],$smilie[$i]);
}
$file[$i]='<img border="0"
src="./bilder/smilies/'.$temp2['file'].'">';
$neu_post=preg_replace("/$smilie[$i]/",$file[$i],$neu_post);
echo $smilie[$i].'<br>';
$neu_post1=substr($neu_post, 0, 60+$x);
}
Expected result:
----------------
Memoryuse grows very fast until system hangup.
--
Edit bug report at http://bugs.php.net/?id=37125&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37125&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=37125&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37125&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=37125&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=37125&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=37125&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=37125&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=37125&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=37125&r=support
Expected behavior: http://bugs.php.net/fix.php?id=37125&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=37125&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=37125&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=37125&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37125&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=37125&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=37125&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=37125&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=37125&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=37125&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=37125&r=mysqlcfg