Crash in nsImapService::FetchMimePart with FiltaQuilla add-on
Categories
(MailNews Core :: Networking: IMAP, defect)
Tracking
(thunderbird_esr6069+ fixed, thunderbird_esr6868+ fixed, thunderbird69 fixed, thunderbird70 fixed)
People
(Reporter: wsmwk, Assigned: jorgk-bmo)
Details
(Keywords: crash)
Crash Data
Attachments
(1 file)
|
1.27 KB,
patch
|
mkmelin
:
review+
jorgk-bmo
:
approval-comm-beta+
jorgk-bmo
:
approval-comm-esr68+
|
Details | Diff | Splinter Review |
| Assignee | ||
Comment 1•7 years ago
|
||
Comment 2•7 years ago
|
||
| Assignee | ||
Comment 3•7 years ago
|
||
Comment 4•7 years ago
|
||
(In reply to Jorg K (GMT+2) from comment #3)
Comment on attachment 9084569 [details] [diff] [review]
1513826-fix-crash.patchPretty rare crash, some add-on must be calling this with a "bad" URL.
Interesting, I am getting quite a few reports on this, how would the following code generate bad URLs? Are you talking about bad folder paths?
{
this.msgURI = aMsgHdr.folder.generateMessageURI(aMsgHdr.messageKey);
this.attachments = aMimeMessage.allAttachments;
let messenger = Cc["@mozilla.org/messenger;1"].createInstance(Ci.nsIMessenger);
if (this.attachments.length > 0) {
let msgURIs = [],
contentTypes = [],
urls = [],
displayNames = [];
for (let j = 0; j < this.attachments.length; j++) {
let attachment = this.attachments[j];
msgURIs.push(this.msgURI);
contentTypes.push(attachment.contentType);
urls.push(attachment.url);
displayNames.push(attachment.name);
util.logDebug("Detach attachment [" + j + "] to " + uniqueFile.path +
"...\n msgURI=" + this.msgURI +
"\n att.url=" + attachment.url +
"\n att.ncontentType=" + attachment.contentType)
}
messenger.detachAttachmentsWOPrompts(this.directory, this.attachments.length,
contentTypes, urls, displayNames, msgURIs, null);
}
}
| Assignee | ||
Comment 5•7 years ago
|
||
I can't see how the code you pasted into comment #4 is relevant. It doesn't show a call to nsImapService::FetchMimePart() so I can't see which URL you're passing in.
In general, the nsIURI passed into the function is QI'ed to nsIMsgMailNewsUrl, so if it doesn't implement that interface, it will crash. With the patch, it will return an error. So if you call that function from your add-on(s), the least you can do is to dump out the .spec of the nsIURI before the call so we can see what gets passed in there. Surely something link file: or http(s): URLs are not nsIMsgMailNewsUrls.
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/67b687a5aad6
Don't crash in nsImapService::FetchMimePart() if URL passed in can't be QI'ed. r=mkmelin
Comment 7•7 years ago
|
||
(In reply to Jorg K (GMT+2) from comment #5)
I can't see how the code you pasted into comment #4 is relevant. It doesn't show a call to
nsImapService::FetchMimePart()so I can't see which URL you're passing in.In general, the nsIURI passed into the function is QI'ed to nsIMsgMailNewsUrl, so if it doesn't implement that interface, it will crash. With the patch, it will return an error. So if you call that function from your add-on(s), the least you can do is to dump out the .spec of the nsIURI before the call so we can see what gets passed in there. Surely something link file: or http(s): URLs are not nsIMsgMailNewsUrls.
It calls messenger.detachAttachmentsWOPrompts, which is part of the original stack trace:
0 xul.dll nsImapService::FetchMimePart comm/mailnews/imap/src/nsImapService.cpp:400
1 xul.dll nsMessenger::SaveAttachment comm/mailnews/base/src/nsMessenger.cpp:730
2 xul.dll nsMessenger::DetachAttachmentsWOPrompts comm/mailnews/base/src/nsMessenger.cpp:650
| Assignee | ||
Comment 8•7 years ago
|
||
Unrelated: The NNTP and mailbox equivalents QI to nsIMsgMailNewsUrl straight away and return an error if unsuccessful:
https://searchfox.org/comm-central/rev/99e635c4517ff1689d25f01b41f0753160abf7ac/mailnews/local/src/nsMailboxService.cpp#235
https://searchfox.org/comm-central/rev/99e635c4517ff1689d25f01b41f0753160abf7ac/mailnews/news/src/nsNntpService.cpp#378
So this is the right fix.
Looking at your call stack, the aURI parameter of nsImapService::FetchMimePart() is a URI produced from the const nsACString &aURL, parameter passed into nsMessenger::SaveAttachment() (nsMessenger.cpp:730) and that comes from the first of the URL strings passed into nsMessenger::DetachAttachmentsWOPrompts() (nsMessenger.cpp:650).
So in your code that would be the urls variable which comes from attachment.url. So I guess that will fail big time if the attachment was detached, since than this will be a file: URL or it was a so-called "external" attachment (mainly used in feeds) which is a http(s): URL.
Dump out your urls variable.
Comment 9•7 years ago
|
||
I'm wondering, if this crash could be related to my still existing problems and trials in upgrading the AttachmentsExtractor extension to "AttachmentExtractor Continued". In my tests Thunderbird crashes dependent on my try and error trials to fix a function to fetchMimeParts.
lines 433 and following:
https://gitlab.com/ThunderbirdMailDE/attachment-extractor-continued/blob/2.0a1-20190810/chrome/content/aec_js_messenger.js#L433
| Assignee | ||
Comment 10•7 years ago
|
||
TB 69 beta 3:
https://hg.mozilla.org/releases/comm-beta/rev/4081e478928cf08b3eecda59423387a6eefd86eb
| Assignee | ||
Updated•6 years ago
|
| Assignee | ||
Comment 11•6 years ago
|
||
TB 68.0 ESR:
https://hg.mozilla.org/releases/comm-esr68/rev/823285a5b6f96b40545926b9da999dc5b45f22af
| Assignee | ||
Comment 12•6 years ago
|
||
TB 60.9 ESR:
https://hg.mozilla.org/releases/comm-esr60/rev/448d166534091217fbc9e887025eceec12eefee4
Comment 13•6 years ago
|
||
TB 60.9 ESR:
https://hg.mozilla.org/releases/comm-esr60/rev/448d166534091217fbc9e887025eceec12eefee4
great stuff - this will throw for a proper stack trace? I will add the URL parameter to my catch.
| Assignee | ||
Comment 14•6 years ago
|
||
This will stop the crash. The function will return an error and it's likely that you'll see that as a throw in JS code.
Description
•