Closed Bug 1940605 Opened 1 year ago Closed 1 year ago

Regression in TB 128.6.0: Drafts and templates which are S/MIME signed lose their content on reuse

Categories

(MailNews Core :: Security: S/MIME, defect, P1)

Thunderbird 128
defect

Tracking

(thunderbird_esr128 fixed, thunderbird135 fixed)

VERIFIED FIXED
136 Branch
Tracking Status
thunderbird_esr128 --- fixed
thunderbird135 --- fixed

People

(Reporter: francesco, Assigned: KaiE)

References

(Regression)

Details

(Keywords: regression, Whiteboard: [regression 128.5.2->128.6.0])

Attachments

(1 file)

Set up an IMAP account using S/MIME and configure it so messages are signed by default.
Create a draft or template, then try to edit the draft or create a new message from the template.

Result: The compose window is empty.

This worked in 128.5.2, so some of the backports must have caused it:
https://hg.mozilla.org/releases/comm-esr128/pushloghtml?fromchange=c489b0433bc2&tochange=86c514fafdab,
likely bug 1852662 or bug 1919290.

I haven't tested with a POP3 account or using PGP.

Flags: needinfo?(kaie)
Whiteboard: [regression 128.5.2->128.6.0]

Thanks for the report, I can reproduce, it's caused by the new checks from bug 1919290.

Assignee: nobody → kaie
Severity: -- → S2
Flags: needinfo?(kaie)
Priority: -- → P1
Regressed by: 1919290

We fail here:
https://searchfox.org/comm-esr128/rev/f7ecd1ad34d07dc62c3eaac96952d2e789291522/mailnews/mime/src/mimemcms.cpp#134

We try to interpret the stream_closure as mime_stream_data, but that fails, because it has type mime_draft_data.

In the past, this can have coincidentally worked, because:

  • the first data member that is accessed by the following code is mime_stream_data::channel
  • in type mime_draft_data, in the memory layout of the structure, there is a pointer member "stream" which is currently unused per comments, and always zero.
  • apparently that null value might have caused the check for a non-null nsCOMPtr to have to decide "empty pointer", and consequently, no other data members were accessed.

In this specific code location, if we don't return on the unexpected type, but let the remainder of the function continue, the draft is loaded correctly.

I've reviewed all places that use AsMimeStreamData and AsMimeDraftData.

I found one additional place that would be affected by the same change of behavior.

I suggest to revert both places to the previous behavior, which is, let the code continue if we find the wrong type (which would previously happen when the mime_stream_data->channel member was null, which it was always when the pointer was pointing to an instance of type mime_draft_data).

(In reply to Kai Engert [:KaiE:] from comment #2)

In the past, this can have coincidentally worked, because:

  • the first data member that is accessed by the following code is mime_stream_data::channel
  • in type mime_draft_data, in the memory layout of the structure, there is a pointer member "stream" which is currently unused per comments, and always zero.

I missed to explain:
The mime_stream_data::channel members and the mime_draft_data::stream data members seem to be at the same memory offset in the object, which is the reason for the following behavior:

  • apparently that null value might have caused the check for a non-null nsCOMPtr to have to decide "empty pointer", and consequently, no other data members were accessed.

In this specific code location, if we don't return on the unexpected type, but let the remainder of the function continue, the draft is loaded correctly.

Status: NEW → ASSIGNED
Target Milestone: --- → 136 Branch

Pushed by kaie@kuix.de:
https://hg.mozilla.org/comm-central/rev/32f816740a60
Fix a regression, allow S/MIME signed drafts to load. r=#thunderbird-back-end-reviewers

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Duplicate of this bug: 1935898
Pushed by kaie@kuix.de: https://hg.mozilla.org/comm-central/rev/911132303135 follow-up - Fix clang-format error. rs=clang-format DONTBUILD

Working fine for S/MIME-signed drafts and templates, thanks for addressing this quickly.

Status: RESOLVED → VERIFIED
Duplicate of this bug: 1940961
Duplicate of this bug: 1941260
Duplicate of this bug: 1930858
Duplicate of this bug: 1941664
Duplicate of this bug: 1941744
Duplicate of this bug: 1941745
Duplicate of this bug: 1941748
Duplicate of this bug: 1941778
Duplicate of this bug: 1941785

Comment on attachment 9446536 [details]
Bug 1940605 - Fix a regression, allow S/MIME signed drafts to load. r=#thunderbird-back-end-reviewers

[Approval Request Comment]
Regression caused by (bug #): 1919290
User impact if declined: forwarding or draft/template editing of s/mime messages unusable
Testing completed (on c-c, etc.): yes
Risk to taking this patch (and alternatives if risky): very low

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined:
Testing completed (on c-c, etc.):
Risk to taking this patch (and alternatives if risky):

Attachment #9446536 - Flags: approval-comm-esr128?
Attachment #9446536 - Flags: approval-comm-beta?

Comment on attachment 9446536 [details]
Bug 1940605 - Fix a regression, allow S/MIME signed drafts to load. r=#thunderbird-back-end-reviewers

[Triage Comment]
Approved for beta
Approved for esr128

Attachment #9446536 - Flags: approval-comm-esr128?
Attachment #9446536 - Flags: approval-comm-esr128+
Attachment #9446536 - Flags: approval-comm-beta?
Attachment #9446536 - Flags: approval-comm-beta+
Duplicate of this bug: 1942106
Duplicate of this bug: 1942060
Duplicate of this bug: 1942100
Duplicate of this bug: 1942091
Duplicate of this bug: 1942038
Duplicate of this bug: 1942034
Duplicate of this bug: 1942240
Duplicate of this bug: 1942287
Duplicate of this bug: 1942243
Duplicate of this bug: 1942337
Duplicate of this bug: 1942433
Duplicate of this bug: 1942683
Duplicate of this bug: 1942776
Duplicate of this bug: 1942813
Duplicate of this bug: 1943012
Duplicate of this bug: 1941422
Duplicate of this bug: 1943061
Duplicate of this bug: 1943279
Duplicate of this bug: 1943265
Duplicate of this bug: 1943544
Duplicate of this bug: 1944120
Duplicate of this bug: 1945078
Duplicate of this bug: 1945206
Duplicate of this bug: 1945498
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: