Memleak in ereg() and eregi() functions
| Bug #48416 | Memleak in ereg() and eregi() functions | ||||
|---|---|---|---|---|---|
| Submitted: | 2009-05-28 16:57 UTC | Modified: | 2009-05-30 11:55 UTC | ||
| From: | bmorel at ssi dot fr | Assigned: | |||
| Status: | Closed | Package: | Regexps related | ||
| PHP Version: | 5.2.9 | OS: | CentOS 5.3 | ||
| Private report: | No | CVE-ID: | None | ||
[2009-05-28 16:57 UTC] bmorel at ssi dot fr
Description:
------------
When repeating an ereg() or eregi() on different patterns, the memory usage of httpd (or php if executed from the command-line) gets huge (about 1GB for the example below) for the time the script executes, then the memory is freed.
During this time, the memory_get_usage() stays normal, and php's memory limit doesn't trigger.
When repeating the ereg() with the same pattern each time, the memory usage stays normal; this happens only when repeating with a different pattern each time.
Verified on CentOS with PHP 5.2.6 & 5.2.9
Verified on Windows XP with PHP 5.2.8
Reproduce code:
---------------
<?php
for ($i=0;$i<1000000;$i++) ereg("$i","test");
?>
Expected result:
----------------
Memory usage staying low.
Actual result:
--------------
Memory usage as shown by "top -d 1" gets huge.
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2009-05-28 18:17 UTC] bmorel at ssi dot fr
[2009-05-28 21:58 UTC] scottmac@php.net
[2009-05-29 21:39 UTC] bmorel at ssi dot fr
[2009-05-29 23:14 UTC] scottmac@php.net
[2009-05-30 11:55 UTC] bmorel at ssi dot fr