php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79951 Memory leak in str_replace of empty string
Submitted: 2020-08-10 22:31 UTC Modified: 2020-08-11 08:28 UTC
From: changochen1 at gmail dot com Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 8.0Git-2020-08-10 (Git) OS:
Private report: No CVE-ID: None
 [2020-08-10 22:31 UTC] changochen1 at gmail dot com
Description:
------------
We found a memory leak in PHP. Please refer to the POC.

Test script:
---------------
<?
$a = array (   4 ,   1 , $a , 1 , 1.500000 , 7 , false , 'x' , 'x' , 500    ) ;
foreach ( $a as $b )   str_replace ( $GLOBALS , $a , $a )  ;


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-11 07:15 UTC] sjon@php.net
this seems to have been fixed in 8.0alpha3 already, see https://3v4l.org/2vhhJ#v800alpha1
 [2020-08-11 08:26 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2020-08-11 08:26 UTC] nikic@php.net
Reduced:

<?php
str_replace([""], [1000], "foo");
 [2020-08-11 08:28 UTC] nikic@php.net
-Summary: Memory leak in zend_string +Summary: Memory leak in str_replace of empty string
 [2020-08-11 08:37 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=9d9dffe60aee0fb469ee0d414eca2a5033a7eafc
Log: Fixed bug #79951
 [2020-08-11 08:37 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC