-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The original fix for that bug[1] broke the formerly working composition of message/rfc822 messages, which results in a segfault when freeing the message body now. While `imap_mail_compose()` does not really support composition of meaningful message/rfc822 messages (although libc-client appears to support that), some code may still use this to compose partial messages, and using string manipulation to create the final message. The point is that libc-client expects `TYPEMESSAGE` with an explicit subtype of `RFC822` to have a `nested.msg` (otherwise there will be a segfault during free), but not to have any `contents.text.data` (this will leak otherwise). [1] <http://git.php.net/?p=php-src.git;a=commit;h=0d022ddf03c5fabaaa22e486d1e4a367ed9170a7> Closes GH-6343.
- Loading branch information
Showing
3 changed files
with
48 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--TEST-- | ||
Bug #80220 (imap_mail_compose() may leak memory) - message/rfc822 regression | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('imap')) die('skip imap extension not available'); | ||
?> | ||
--FILE-- | ||
<?php | ||
$bodies = [[ | ||
'type' => TYPEMESSAGE, | ||
'subtype' => 'RFC822', | ||
], [ | ||
'contents.data' => 'asd', | ||
]]; | ||
var_dump(imap_mail_compose([], $bodies)); | ||
|
||
$bodies = [[ | ||
'type' => TYPEMESSAGE, | ||
], [ | ||
'contents.data' => 'asd', | ||
]]; | ||
var_dump(imap_mail_compose([], $bodies)); | ||
?> | ||
--EXPECT-- | ||
string(53) "MIME-Version: 1.0 | ||
Content-Type: MESSAGE/RFC822 | ||
|
||
|
||
" | ||
string(53) "MIME-Version: 1.0 | ||
Content-Type: MESSAGE/RFC822 | ||
|
||
|
||
" |