Bug 1404045 - Follow-up: Protect against Tell() failure. r=baku
authorJorg K <jorgk@jorgk.com>
Mon, 02 Oct 2017 14:49:04 +0200
changeset 29078 20ea7ac93345f86296526dcdbf73dbdc868fa7a8
parent 29077 1688845160a27cc6a665b251351af1f90c3b666a
child 29079 5ee768e3a01b47060e05f956bacc5c8c4ff2a618
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1404045
Bug 1404045 - Follow-up: Protect against Tell() failure. r=baku
mailnews/base/util/nsMsgProtocol.cpp
--- a/mailnews/base/util/nsMsgProtocol.cpp
+++ b/mailnews/base/util/nsMsgProtocol.cpp
@@ -467,19 +467,19 @@ nsresult nsMsgProtocol::LoadUrl(nsIURI *
         {
           // open buffered, asynchronous input stream
           rv = m_transport->OpenInputStream(0, 0, 0, getter_AddRefs(m_inputStream));
           if (NS_FAILED(rv)) return rv;
         }
 
         int64_t offset = 0;
         nsCOMPtr<nsISeekableStream> seekable(do_QueryInterface(m_inputStream));
-        if (seekable)
-          seekable->Tell(&offset);
-
+        if (seekable && NS_FAILED(seekable->Tell(&offset))) {
+          offset = 0;
+        }
         // m_readCount can be -1 which means "read as much as we can".
         // We pass this on as UINT64_MAX, which is in fact uint64_t(-1).
         RefPtr<SlicedInputStream> slicedStream =
           new SlicedInputStream(m_inputStream, uint64_t(offset),
                                 m_readCount == -1 ? UINT64_MAX : uint64_t(m_readCount));
         nsCOMPtr<nsIInputStreamPump> pump;
         rv = NS_NewInputStreamPump(getter_AddRefs(pump), slicedStream);
         if (NS_FAILED(rv)) return rv;