From:  pear-qa@lists.php.net ("slgundam@gmail.com")
Date:  22 Feb 2018 03:51:31 Hong Kong Time
Newsgroup:  news.php.net/php.pear.bugs
Subject:  

[PEAR-BUG] Bug #21215 [Com]: "multipart/signed" messages decoding issue

NNTP-Posting-Host:  null

Edit report at https://pear.php.net/bugs/bug.php?id=21215&edit=1

 ID:               21215
 Comment by:       slgundam at gmail dot com
 Reported By:      sgironella at schema31 dot it
 Summary:          "multipart/signed" messages decoding issue
 Status:           Open
 Type:             Bug
 Package:          Mail_mimeDecode
 Operating System: FreeBSD 11
 Package Version:  1.5.6
 PHP Version:      5.6.30
 Roadmap Versions: 
 New Comment:

Roundcube could also fix this by adding an extra check in
decode_raw_message to check this before calling getMimeNumbers

in EmailReporting i fixed it like this
https://github.com/mantisbt-plugins/EmailReporting/blob/master/core/Mail/Parser.php#L257
https://github.com/mantisbt-plugins/EmailReporting/blob/master/core/Mail/Parser.php#L236


Previous Comments:
------------------------------------------------------------------------

[2017-06-01 03:21:42] sgironella

Added #patch
bug:21215;patch:multipart_signed_patch;revision:1496301702;.

------------------------------------------------------------------------

[2017-06-01 03:06:48] alan_k

Can you suggest a patch

------------------------------------------------------------------------

[2017-05-31 09:11:31] sgironella

Description:
------------
On "multipart/signed" messages, "_decode()" method  doesn't return a
parts list but an associative array ("msg_body", "sig_hdr", "sig_body");
this lead "getMimeNumbers()" method to an infinite loop as it expects to
iterate over a parts list and it doesn't manage those keys.

See the case "case 'multipart/signed': // PGP" at line 324

Actual result:
--------------
[31-May-2017 12:41:33 Europe/Rome] PHP Fatal error:  Allowed memory size
of 134217728 bytes exhausted (tried to allocate 72 bytes) in
/webroot/vendor/pear-pear.php.net/Mail_mimeDecode/Mail/mimeDecode.php on
line 425
[31-May-2017 12:41:33 Europe/Rome] PHP Stack trace:
[31-May-2017 12:41:33 Europe/Rome] PHP   1. {main}()
/webroot/index.php:0
[31-May-2017 12:41:33 Europe/Rome] PHP   2. include_once()
/webroot/index.php:291
[31-May-2017 12:41:33 Europe/Rome] PHP   3. rcube_message->__construct()
/webroot/program/steps/mail/show.inc:49
[31-May-2017 12:41:33 Europe/Rome] PHP   4. rcube_dbmail->get_message()
/webroot/program/lib/Roundcube/rcube_message.php:94
[31-May-2017 12:41:33 Europe/Rome] PHP   5.
rcube_dbmail->retrieve_message()
/webroot/program/lib/Roundcube/rcube_dbmail.php:1100
[31-May-2017 12:41:33 Europe/Rome] PHP   6.
rcube_dbmail->decode_raw_message()
/webroot/program/lib/Roundcube/rcube_dbmail.php:4316
[31-May-2017 12:41:33 Europe/Rome] PHP   7.
Mail_mimeDecode->getMimeNumbers()
/webroot/program/lib/Roundcube/rcube_dbmail.php:5425
[31-May-2017 12:41:33 Europe/Rome] PHP   8.
Mail_mimeDecode->getMimeNumbers()
/webroot/vendor/pear-pear.php.net/Mail_mimeDecode/Mail/mimeDecode.php:415

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=21215&edit=1