Bug 1513826 - Don't crash in nsImapService::FetchMimePart() if URL passed in can't be QI'ed. r=mkmelin a=jorgk
authorJorg K <jorgk@jorgk.com>
Mon, 12 Aug 2019 09:56:22 +0200
changeset 36154 4081e478928cf08b3eecda59423387a6eefd86eb
parent 36153 a221fedbe06298daff382f00ab1e5890c3f6b1b3
child 36155 c850972a72351538ece8d91ed11c2f810769df3f
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersmkmelin, jorgk
bugs1513826
Bug 1513826 - Don't crash in nsImapService::FetchMimePart() if URL passed in can't be QI'ed. r=mkmelin a=jorgk
mailnews/imap/src/nsImapService.cpp
--- a/mailnews/imap/src/nsImapService.cpp
+++ b/mailnews/imap/src/nsImapService.cpp
@@ -358,17 +358,18 @@ NS_IMETHODIMP nsImapService::FetchMimePa
   NS_ENSURE_SUCCESS(rv, rv);
   rv = nsParseImapMessageURI(aMessageURI, folderURI, &key,
                              getter_Copies(mimePart));
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIImapMessageSink> imapMessageSink(
         do_QueryInterface(folder, &rv));
     if (NS_SUCCEEDED(rv)) {
       nsCOMPtr<nsIImapUrl> imapUrl = do_QueryInterface(aURI);
-      nsCOMPtr<nsIMsgMailNewsUrl> msgurl(do_QueryInterface(aURI));
+      nsCOMPtr<nsIMsgMailNewsUrl> msgurl(do_QueryInterface(aURI, &rv));
+      NS_ENSURE_SUCCESS(rv, rv);
 
       msgurl->SetMsgWindow(aMsgWindow);
       msgurl->RegisterListener(aUrlListener);
 
       if (!mimePart.IsEmpty()) {
         return FetchMimePart(imapUrl, nsIImapUrl::nsImapMsgFetch, folder,
                              imapMessageSink, aURL, aDisplayConsumer, msgKey,
                              mimePart);