Skip to content

Properly fix #80220 #6341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Properly fix #80220 #6341

wants to merge 1 commit into from

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Oct 15, 2020

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. As such, we fix this to avoid a regression.

[1] http://git.php.net/?p=php-src.git;a=commit;h=0d022ddf03c5fabaaa22e486d1e4a367ed9170a7


This fix is most ugly, but apparently libc-client uses the same distinction in multiple places to dispatch to the nested union members. I have not attached a test for this issue, because composing message/rfc822 messages inevitably leaks at least a single byte. I should also mention that this patch doesn't fix the guaranteed segfault if somebody tries to compose a multipart message with a message/rfc822 part, because that was already broken, and should be considered a separate issue.

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.  As such, we fix this to avoid a regression.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=0d022ddf03c5fabaaa22e486d1e4a367ed9170a7>
@cmb69 cmb69 added the Bug label Oct 15, 2020
@cmb69
Copy link
Member Author

cmb69 commented Oct 15, 2020

Ugh, more strangeness to deal with; switching to draft.

@cmb69 cmb69 marked this pull request as draft October 15, 2020 16:36
@cmb69
Copy link
Member Author

cmb69 commented Oct 15, 2020

Ah, strangeness resolved. From https://bugs.php.net/bug.php?id=80242:

Note that composing a multipart message with one or more message/rfc822 where the subtype is not explicitly specified does not segfault, due to the way this is handled by lib-client (2007).

So the patch looks good (assuming that libc-client handling didn't change).

@cmb69
Copy link
Member Author

cmb69 commented Oct 16, 2020

Closing in favor of PR #6343.

@cmb69 cmb69 closed this Oct 16, 2020
@cmb69 cmb69 deleted the cmb/80220-2 branch October 16, 2020 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant