Closed
Bug 1466343
Opened 6 years ago
Closed 6 years ago
Subject of message displays incorrecly in thread pane if subject ends with RFC2047 token =?
Categories
(MailNews Core :: General, defect)
Tracking
(thunderbird_esr52 fixed, thunderbird_esr60 fixed, thunderbird60 fixed, thunderbird61 wontfix, thunderbird62 fixed)
RESOLVED
FIXED
Thunderbird 62.0
People
(Reporter: bob, Assigned: jorgk-bmo)
References
Details
Attachments
(2 files, 3 obsolete files)
10.90 KB,
image/png
|
Details | |
12.33 KB,
patch
|
mkmelin
:
review+
jorgk-bmo
:
approval-comm-beta+
jorgk-bmo
:
approval-comm-esr60+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36 Steps to reproduce: I sent an email. You can see the subject. i'm using beta version 60.0b6 (32-bit) Actual results: The subject shown is a string of a characters (with o symbol). The attached JPG shows the problem clearly. (email address covered in red for security). Expected results: The correct subject "Re: 1N-2C-2D-2S=?" can be seen Could this have been caused by ending the subject with a ? .
Assignee | ||
Comment 1•6 years ago
|
||
Confirmed in TB 52 and TB 60 beta. TB 52 shows replacement characters, �, TB 60 shows those ångström characters. =? is the opening token of an RFC2047 sequence. The strange thing is that the mis-decoding only happens in the thread pane.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: Subject of sent emails messed up → Subject of message displays incorrecly in thread pane of subject ends with RFC2047 token =?
Assignee | ||
Comment 2•6 years ago
|
||
Another fact: It only happens in replies, when "Re: " is part of the message. Works fine with new messages and subject "1N-2C-2D-2S=?". So this is related to the special "Re: " processing.
Assignee | ||
Comment 3•6 years ago
|
||
Looks like the cause is here https://dxr.mozilla.org/comm-central/rev/51678c5b0b3edd827c57a70f1c5baf02d44acead/mailnews/base/util/nsMsgUtils.cpp#652 in NS_MsgStripRE(). The =? without closing ?= trips up that logic :-(
Assignee | ||
Comment 4•6 years ago
|
||
Reviewer, the simple test case is this: Create a new message, paste |Re: 1N-2C-2D-2S=?| into the subject. Save. Look at the draft in the draft folder. For a laugh: https://dxr.mozilla.org/comm-central/rev/51678c5b0b3edd827c57a70f1c5baf02d44acead/mailnews/base/util/nsMsgUtils.h#100
Assignee: nobody → jorgk
Status: NEW → ASSIGNED
Attachment #8982841 -
Flags: review?(mkmelin+mozilla)
Attachment #8982841 -
Flags: review?(acelists)
Assignee | ||
Comment 5•6 years ago
|
||
OK, NS_MsgStripRE() was a total mess. It tried to extract the charset and then never used that value since the header was re-encoded in UTF-8 anyway. I cleaned out most of the junk and switched to proper strings.
Attachment #8982841 -
Attachment is obsolete: true
Attachment #8982841 -
Flags: review?(mkmelin+mozilla)
Attachment #8982841 -
Flags: review?(acelists)
Attachment #8982845 -
Flags: review?(mkmelin+mozilla)
Attachment #8982845 -
Flags: review?(acelists)
Assignee | ||
Comment 6•6 years ago
|
||
I'm trying to get the tests to go, at least manually. They compile but don't link. Tom, do you know how to achieve this? I must have built TestMailCookie.exe once upon a time, bug 1320861 comment #7, but I didn't take any notes :-(
Attachment #8982848 -
Flags: feedback?(mozilla)
Assignee | ||
Comment 7•6 years ago
|
||
Philipp, can you tell me how to get the test program to link?
Flags: needinfo?(philipp)
Assignee | ||
Comment 8•6 years ago
|
||
Comment on attachment 8982848 [details] [diff] [review] 1466343-TestMsgStripRE.patch Review of attachment 8982848 [details] [diff] [review]: ----------------------------------------------------------------- ::: mailnews/base/test/moz.build @@ +19,5 @@ > > LOCAL_INCLUDES += [ > '/%s/netwerk/test' % CONFIG['mozreltopsrcdir'], > '/%s/xpcom/tests' % CONFIG['mozreltopsrcdir'], > ] I tried adding: USE_LIBS += [ 'mozglue', 'xul', ] OS_LIBS += CONFIG['MOZ_ZLIB_LIBS'] but still get heaps of unresolved external references when linking.
Assignee | ||
Comment 9•6 years ago
|
||
Finally the thing is becoming a little clearer. TestMailCookie was ported to gtest in bug 1322072 which landed in Jan. 2017. I ran TestMailCookie before the port in Dec 2016 (bug 1320861 comment #7). Back then it wasn't a gtest. So I think the way forward here is: - Find out how to run TestMailCookie as a gtest. - Port TestMsgStripRE.cpp to be a gtest as well.
Assignee | ||
Comment 10•6 years ago
|
||
This resurrects TestMsgStripRE and converts it to a gtest. It would be nice to work out how to run it. As mentioned in bug 1320861 comment #8, when running |mach gtest TestMsgStripRE*|, I got: Error loading c:\mozilla-source\comm-central\obj-x86_64-pc-mingw32\dist\bin\gtest/xul.dll: The specified module could not be found. Copying a xul.dll to that directory then gives: TEST-UNEXPECTED-FAIL | gtest | Not compiled with enable-tests That's surprising, since I'm always building with |ac_add_options --enable-tests|.
Attachment #8982848 -
Attachment is obsolete: true
Attachment #8982848 -
Flags: feedback?(mozilla)
Flags: needinfo?(philipp)
Attachment #8982906 -
Flags: feedback?(n.nethercote)
Comment 11•6 years ago
|
||
Comment on attachment 8982845 [details] [diff] [review] 1466343-NS_MsgStripRE.patch (v2) Review of attachment 8982845 [details] [diff] [review]: ----------------------------------------------------------------- LGTM, r=mkmelin
Attachment #8982845 -
Flags: review?(mkmelin+mozilla)
Attachment #8982845 -
Flags: review?(acelists)
Attachment #8982845 -
Flags: review+
Assignee | ||
Comment 12•6 years ago
|
||
OK, I'll land the fix and then we see how to resurrect the test. BTW, the test needs to be changed since after decoding we always re-encode in UTF-8, yet the test, which must pre-date JS Mime, expects the original charset.
Keywords: leave-open
Assignee | ||
Comment 13•6 years ago
|
||
Actually, this is a blatant "read after free", so really a security issue.
Group: mail-core-security
Assignee | ||
Comment 14•6 years ago
|
||
Pushed by mozilla@jorgk.com: https://hg.mozilla.org/comm-central/rev/629f8f4c79f9db0ec17e905478e25f5fe5b60208 fix NS_MsgStripRE(). r=mkmelin
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 62.0
Assignee | ||
Comment 15•6 years ago
|
||
Comment on attachment 8982845 [details] [diff] [review] 1466343-NS_MsgStripRE.patch (v2) [Triage Comment]
Attachment #8982845 -
Flags: approval-comm-esr60+
Attachment #8982845 -
Flags: approval-comm-beta+
Assignee | ||
Updated•6 years ago
|
Summary: Subject of message displays incorrecly in thread pane of subject ends with RFC2047 token =? → Subject of message displays incorrecly in thread pane if subject ends with RFC2047 token =?
Comment 16•6 years ago
|
||
It's not clear to me what I'm being asked here. If it's about how to run a gtest, I would suggest this:
> mach gtest '*TestMsgStripRE*'
Assignee | ||
Comment 17•6 years ago
|
||
TB 60 beta 7 (BETA_60_CONTINUATION branch): https://hg.mozilla.org/releases/comm-beta/rev/d332994066acfec292b8ead77163c6ea10a315b1
status-thunderbird60:
--- → fixed
status-thunderbird61:
--- → affected
status-thunderbird62:
--- → fixed
status-thunderbird_esr52:
--- → wontfix
status-thunderbird_esr60:
--- → affected
Assignee | ||
Comment 18•6 years ago
|
||
(In reply to Nicholas Nethercote [:njn] from comment #16) > It's not clear to me what I'm being asked here. If it's about how to run a > gtest, I would suggest this: > > mach gtest '*TestMsgStripRE*' Indeed, but that doesn't work, see comment #10. You could also take a look at attachment 8982906 [details] [diff] [review] which has f?njn.
Comment 19•6 years ago
|
||
Comment on attachment 8982906 [details] [diff] [review] 1466343-TestMsgStripRE.patch (v2) Review of attachment 8982906 [details] [diff] [review]: ----------------------------------------------------------------- The code looks reasonable to me. I don't know about the problems with running it, alas. ::: mailnews/base/test/TestMsgStripRE.cpp @@ +80,5 @@ > testInfoStructs[i].expectedOutput, > testInfoStructs[i].expectedDidModify); > if (result) > { > + printf("Failed: %s, i=%d | result=%d\n", __FILE__, i, result); You can do custom failure messages by using the '<<' operator with EXPECT_TRUE and other gtest macros/functions, e.g.: > EXPECT_TRUE(result == 0) << "Got non-zero result: " << result; @@ +88,4 @@ > } > > if (allTestsPassed) { > + printf("all tests passed\n"); I don't think you need this.
Attachment #8982906 -
Flags: feedback?(n.nethercote) → feedback+
Assignee | ||
Comment 20•6 years ago
|
||
Thanks Nicholas. I'll take this to a new bug. The test wouldn't work anyway, see comment #12.
Assignee | ||
Updated•6 years ago
|
Component: Untriaged → General
Product: Thunderbird → MailNews Core
Assignee | ||
Comment 21•6 years ago
|
||
Comment on attachment 8982906 [details] [diff] [review] 1466343-TestMsgStripRE.patch (v2) Moved to bug 1466748.
Attachment #8982906 -
Attachment is obsolete: true
Updated•6 years ago
|
Group: mail-core-security → core-security-release
Assignee | ||
Comment 24•6 years ago
|
||
TB 52.9: https://hg.mozilla.org/releases/comm-esr52/rev/ff574714a516cb92ca6dc5fae061a905fc115a40
Assignee | ||
Comment 25•6 years ago
|
||
https://hg.mozilla.org/releases/comm-esr60/rev/7318bc0281a5
Updated•4 years ago
|
Group: core-security-release
You need to log in
before you can comment on or make changes to this bug.
Description
•