php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37113 Malicious Memory Management(?)
Submitted: 2006-04-17 21:08 UTC Modified: 2006-04-18 00:02 UTC
From: oliver dot block at lycos dot de Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.1.2 OS: Unix
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: oliver dot block at lycos dot de
New email:
PHP Version: OS:

 

 [2006-04-17 21:08 UTC] oliver dot block at lycos dot de
Description:
------------
preg_replace_callback returns content that should not be in memory!

Reproduce code:
---------------
input:

1. "Tue, 11 Apr 2006 17:09:22 GMT"
2. "Tue, 11 Apr 2006 20:26:57 +0000 (GMT)"
3. ""


function check_date($s)
{
   $muster = "/(Mon, |Tue, |Wed, |Thu, |Fri, |Sat, |Sun, )?(\d\d?) (.{3})
(\d\d\d\d) (\d\d:\d\d(:\d\d)?) (([+-](\d\d(\d\d)))|GMT)/";
   $result = "";
   $result = preg_replace_callback($muster, create_function('$match',
                 '$mon = array("Jan" => "01", "Feb" => "02", "Mar" => "03",
                               "Apr" => "04", "May" => "05", "Jun" => "06",
                               "Jul" => "07", "Aug" => "08", "Sep" => "09",
                               "Okt" => "10", "Nov" => "11", "Dez" => "12");
                  $mm = $mon[$match[3]];
                  return "{$match[2]}.{$mm}.{$match[4]}";
                 '),
             $s);
   return $result;
}


Expected result:
----------------
1. "11.04.2006"
2. "11.04.2006"
3. ""


Actual result:
--------------
1. "11.04.2006"
2. "11.04.2006 (GMT)"
3. ""


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-17 22:59 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Your regex fetches the GMT, so where is the problem.
 [2006-04-18 00:02 UTC] oliver dot block at lycos dot de
But it does not return $match[7] which might contain GMT 
but _not_ (GMT).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 12:01:30 2024 UTC