Closed Bug 1377228 Opened 7 years ago Closed 7 years ago

Crash in nsMsgSend when accessing empty body using nsIMsgSend.sendBody

Categories

(MailNews Core :: Composition, defect)

defect
Not set
critical

Tracking

(thunderbird_esr5255+ fixed, thunderbird55 fixed, thunderbird56 fixed)

RESOLVED FIXED
Thunderbird 56.0
Tracking Status
thunderbird_esr52 55+ fixed
thunderbird55 --- fixed
thunderbird56 --- fixed

People

(Reporter: rkent, Assigned: jorgk-bmo)

Details

(Keywords: crash)

Crash Data

Attachments

(1 file)

This crash primarily occurs in ExQuilla since that is the primary user of this interface.

nsMsgComposeAndSend::GetSendBody(nsAString& aBody) has:

return ConvertToUnicode(charSet.get(), m_attachment1_body, aBody);

m_attachment1_body though is initialized to 0 (null). Its value may come from nsMsgComposeAndSend::SnarfAndCopyBody:

  if (body.Length() > 0)
  {
    m_attachment1_body = ToNewCString(body);

That is, if the body is empty, m_attachment1_body stays null, and ConvertToUnicode crashes.

ExQuilla will implement a workaround for TB 52, but it would be good to fix in the core code. Yes this is mostly my problem.
You have a stack?
Severity: normal → critical
Keywords: crash
I'm not sure why Kent didn't propose a patch since he can readily create the problem.

This is my suggestion, un-compiled and un-tested.
Attachment #8882526 - Flags: feedback?(rkent)
Comment on attachment 8882526 [details] [diff] [review]
1377228-crash-empty-string-encode.patch

Seems to compile ;-) Kent is the best to judge whether this is what he needs.
Attachment #8882526 - Flags: feedback?(rkent) → review?(rkent)
Comment on attachment 8882526 [details] [diff] [review]
1377228-crash-empty-string-encode.patch

Review of attachment 8882526 [details] [diff] [review]:
-----------------------------------------------------------------

Wow, I was not expecting you to fix this, but thanks!

Bug 1377809 is more of a problem for me, I'll probably try to fix that in JsAccount to minimize risk and ask that it be landed on a point release.
Attachment #8882526 - Flags: review?(rkent) → review+
Keywords: checkin-needed
https://hg.mozilla.org/comm-central/rev/eb90850d4a8fda98a79d16acc6d7cb3087f0e812
Assignee: nobody → jorgk
Status: NEW → RESOLVED
Closed: 7 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 56.0
Attachment #8882526 - Flags: approval-comm-esr52?
Attachment #8882526 - Flags: approval-comm-beta+
Attachment #8882526 - Flags: approval-comm-esr52? → approval-comm-esr52+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: