php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51967 iconv_mime_encode() eats all memory
Submitted: 2010-06-01 18:39 UTC Modified: 2010-06-02 10:07 UTC
From: alex dot aulbach at mayflower dot de Assigned:
Status: Duplicate Package: *Mail Related
PHP Version: 5.2.13 OS: linux
Private report: No CVE-ID: None
 [2010-06-01 18:39 UTC] alex dot aulbach at mayflower dot de
Description:
------------
We got this error:

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2194780439 bytes) in

After examining the reason, I found this test to reproduce it.

Because we don't have 5.2.13 in production, this is only tested with 5.2.12, but as far as I know, there was no change here, since that, so it should also be reproduce able with 5.2.13.



Test script:
---------------
<?php


$string = 'Короткое замыкание в цепи датчика емкостного водонагревателя';

error_log(phpversion());
error_log ("1");
error_log (iconv_mime_encode( 'Subject', $string, array(
    'scheme' => 'Q',
    'input-charset' => 'utf-8',
    'output-charset' => 'utf-8',
    'line-length'    => 74,
    'linke-break-chars' => "\r\n")
));

error_log("2");

Actual result:
--------------
The script prints out only "1" and breaks down with the fatal error. Take care! It eats all memory if no limits are here!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-02 05:46 UTC] aharvey@php.net
-Status: Open +Status: Feedback
 [2010-06-02 05:46 UTC] aharvey@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

It's not exactly the same bug, but given that the fix for bug #48289 (which was only committed about a month ago, hence isn't yet in any releases) tinkered with the same function, could you please try a snapshot and see if it fixes the problem?
 [2010-06-02 09:25 UTC] alex dot aulbach at mayflower dot de
-Status: Feedback +Status: Open
 [2010-06-02 09:25 UTC] alex dot aulbach at mayflower dot de
Sorry, I'm tomorrow morning in holiday for 2 weeks and have currently no time to prove that.
 [2010-06-02 09:48 UTC] alex dot aulbach at mayflower dot de
Hi, my colleague tested the script with 5.3.2-1 under debian.

Result is this:

1
PHP Notice:  iconv_mime_encode(): Unknown error (7) in .../test.php on line 14

2
 [2010-06-02 10:07 UTC] aharvey@php.net
-Status: Open +Status: Duplicate
 [2010-06-02 10:07 UTC] aharvey@php.net
5.3.2 also predates the fix I mentioned, hence my request to try a snapshot.

I'm going to close this as a duplicate for now, because my own testing seems to suggest this has been fixed: the test code segfaults in 5.2.13 and works in a current 5.2 snapshot. If you can reproduce it with a snapshot build of 5.2 or 5.3, please reopen the bug.
 [2010-06-02 11:02 UTC] alex dot aulbach at mayflower dot de
We talked here about the results and I searched with this information the bug-DB more carefully.

The problem is described in 43314, 48289, 50954, 43799 ...

So this might be a duplicate.
 [2010-06-02 11:10 UTC] alex dot aulbach at mayflower dot de
BTW: For others, which have the same problem: A fix for this is described in bug #50954 : Just use a bigger size for the line-length. Nearly every mail-client is able to display this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 06 02:01:30 2024 UTC