|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Sec Bug #54238 use-after-free in substr_replace()
Submitted: 2011-03-13 02:29 UTC Modified: 2011-04-13 08:34 UTC
From: Assigned: stas (profile)
Status: Closed Package: Strings related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: 2011-1148
 [2011-03-13 02:29 UTC]
Caused by passing the same variable multiple times to the function, which makes a convert_to_<type>_ex() call to invalid the each pointer of parameter.

Test script:

$f = array(array('A', 'A'));

$z = substr_replace($f, $f, $f, 1);
var_dump($z, $f);

Actual result:
array(1) {
  string(5) "0Dd	y"
array(1) {
  string(1) "0"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-13 18:51 UTC]
-CVE-ID: +CVE-ID: 2011-1148
 [2011-04-13 08:33 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: stas
 [2011-04-13 08:33 UTC]
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 07:01:30 2024 UTC