|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56125 Parsing of headers leads to out of memory problems
Submitted: 2004-07-08 09:03 UTC Modified: 2015-03-23 20:00 UTC
From: contact at packwebhosting dot com Assigned:
Status: Not a bug Package: mailparse (PECL)
PHP Version: Irrelevant OS: Red Hat 9
Private report: No CVE-ID: None
 [2004-07-08 09:03 UTC] contact at packwebhosting dot com

I am using the following
OS version - Red Hat 9
PHP version - 5.0.0RC3
PHP compile string - /configure --with-zlib --with-mysql --enable-mbstring --with-apxs2=/usr/local/apache2/bin/apxs --enable-mailparse
Mailparse version - 2.0b

I am running PHP in CLI mode.

When I call mailparse_msg_parse_file function, for a message with these kind of headers

------Header Starts---------------
Return-Path: <info@site1.ext>
Delivered-To: mailuser-info@site1.ext
Received: (qmail 6168 invoked from network); 13 Apr 2004 07:37:00 -0000
Received: from unknown (HELO pack4) (kirti1@
  by pack3.packsystems.cxm with SMTP; 13 Apr 2004 07:37:00 -0000
Message-ID: <000a01c42129$d5323670$4400a8c0@pack4>
From: "Info SMTP" <info@site1.ext>
To: <>
Cc: <info@site1.ext>
Subject: hello kirti
Date: Tue, 13 Apr 2004 13:04:58 +0530
MIME-Version: 1.0
Content-Type: multipart/related;
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
------Header Ends---------------

I get following error message:
Fatal error: Out of memory: cannot allocate 1936875912 bytes!

I tried checking which header was causing the error, I discovered that if I remove the ';' from 'Content-Type: multipart/related;' and 'multipart/alternative;' , the error disappears. Otherwise this function works fine with other kinds of messages.

Kirti Singh


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-23 20:00 UTC]
-Status: Open +Status: Not a bug
 [2015-03-23 20:00 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 23 12:03:37 2021 UTC