roundcube / roundcubemail

The Roundcube Webmail suite
https://roundcube.net
GNU General Public License v3.0
5.92k stars 1.64k forks source link

Message with attachment, but without message causes php crash #7588

Closed Hallikas closed 4 years ago

Hallikas commented 4 years ago

Version: GIT/master, Latest commit: 5264534c46abdd2405da6f20fea111b13565f39d

2020/09/04` 22:00:28 [error] 30840#30840: *3644 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught Error: Cannot access protected property rcube_message::$body in /data/www/roundcube/program/steps/mail/show.inc:722 Stack trace:

0 /data/www/roundcube/program/include/rcmail_output_html.php(1374): rcmail_message_body(Array)

1 [internal function]: rcmail_output_html->xml_command(Array)

2 /data/www/roundcube/program/include/rcmail_output_html.php(1224): preg_replace_callback('/<roundcube:([-...', Array, '<roundcube:obje...')

3 /data/www/roundcube/program/include/rcmail_output_html.php(782): rcmail_output_html->parse_xml('<roundcube:obje...')

4 /data/www/roundcube/program/include/rcmail_output_html.php(615): rcmail_output_html->parse('message', false)

5 /data/www/roundcube/program/steps/mail/show.inc(177): rcmail_output_html->send('message', false)

6 /data/www/roundcube/index.php(311): include_once('/data/www/round...')

7 /data/www/roundcube/public_html/index.php(26): include('/data/www/round...')

8 {main}

thrown in /data/www/roundcube/program/steps/mail/sho" while reading response header from upstream

I debugged that if mail has only 1 MIME part (attachment), it would cause that error. If message part is added, mail works.

mbox content to test:

From someone@nobody.net  Fri Sep 04 20:58:26 2020
Received: from localhost by localhost with LMTP id KAoFLUKAUl9gfQAA0J78UA for <someone@nobody.net>; Fri, 04 Sep 2020 20:58:26 +0300
From: Good Guy <test@nobody.net>
To: <someone@nobody.net>
Subject: Not Working
Date: Fri, 04 Sep 2020 20:58:26 +0300
Content-Type: multipart/mixed; boundary="=_434296447f9493d19fd80dd0842ba64f"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
X-IMAPbase: 1599246023 0000000002
X-UID: 1
Status: O

--=_434296447f9493d19fd80dd0842ba64f
Content-Transfer-Encoding: base64
Content-Type: application/pdf; name=dummy.pdf
Content-Disposition: attachment; filename=dummy.pdf

JVBERi0xLjQKJSVFT0YK==
--=_434296447f9493d19fd80dd0842ba64f--

From someone@nobody.net  Fri Sep 04 20:56:00 2020
Received: from localhost by localhost with LMTP id oGSVC4ApTV+ZYQAA0J78UA for <someone@nobody.net>; Mon, 31 Aug 2020 19:46:56 +0300
From: Good Guy <test@nobody.net>
To: <someone@nobody.net>
Subject: Working
Date: Fri, 04 Sep 2020 20:56:00 +0300
Content-Type: multipart/mixed; boundary="=_434296447f9493d19fd80dd0842ba64f"
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
X-UID: 2
Status: RO

--=_434296447f9493d19fd80dd0842ba64f
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII; format=flowed

--=_434296447f9493d19fd80dd0842ba64f
Content-Transfer-Encoding: base64
Content-Type: application/pdf; name=dummy.pdf
Content-Disposition: attachment; filename=dummy.pdf

JVBERi0xLjQKJSVFT0YK==
--=_434296447f9493d19fd80dd0842ba64f--
alecpl commented 4 years ago

Fixed.