|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69759 \http\Url() leaks memory for long urls.
Submitted: 2015-06-05 09:25 UTC Modified: 2015-06-16 07:13 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mail at ankr dot dk Assigned:
Status: Duplicate Package: pecl_http (PECL)
PHP Version: 5.6.9 OS: Debian 3.2.65-1+deb7u2 x86_64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mail at ankr dot dk
New email:
PHP Version: OS:


 [2015-06-05 09:25 UTC] mail at ankr dot dk
Using \http\Url() to construct a URL from fragments leaks memory if the constructed url gets too big.
In the attached test example the query part of the url will disappear and replaced with random memory data.
It appears that it's not only happening when query string gets too long, but rather when the total url length exceeds a certain limit.

Test script:
// leak.php

$url = '';   // This length will work as expected
$url = '';  // This length will cause Url() to ignore the 'query' part
$url = ''; // This length will cause Url() to leak

$parsed = parse_url($url);
$parsed['query'] = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';

var_dump((new \http\Url($parsed))->toString());

Actual result:
$ php leak.php
string(47) "��V"

$ php leak.php
string(47) "��}?"

$ php leak.php
string(47) "���G"



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-16 07:13 UTC]
-Status: Open +Status: Duplicate
 [2015-06-16 07:13 UTC]
With which version of pecl_http do you experience this behavior?
This should be fixed since 2.2.1

See bug #69000 and commit 6a206380
 [2015-06-25 09:29 UTC] mail at ankr dot dk
You are right. I was using 2.2.0 and problem went away after upgrade. Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 23 05:01:28 2024 UTC