summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-03 04:26:29 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-03 04:26:29 +0200
commit093b63034758fa8c85543afd6a93bcf1b6da231e (patch)
tree1f636335c5cd4c514c44fc72ae46e9e004919a0f
parent4b76d6427a6650a499f8840fb8b054be70dd1c35 (diff)
downloaduxp-093b63034758fa8c85543afd6a93bcf1b6da231e.tar.gz
Fix cache v1 compression crash in nsCompressOutputStreamWrapper::Close()
-rw-r--r--netwerk/cache/nsCacheEntryDescriptor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/netwerk/cache/nsCacheEntryDescriptor.cpp b/netwerk/cache/nsCacheEntryDescriptor.cpp
index b53ee3058a..64765f8aa1 100644
--- a/netwerk/cache/nsCacheEntryDescriptor.cpp
+++ b/netwerk/cache/nsCacheEntryDescriptor.cpp
@@ -1399,6 +1399,12 @@ nsCompressOutputStreamWrapper::Close()
// Do not allow to initialize stream after calling Close().
mStreamEnded = true;
+ // In some rare cases, flushing the zlib stream can take too long
+ // and we lose our cache entry in the meantime. Do another check
+ // and bail if so.
+ if (!mDescriptor)
+ return NS_ERROR_NOT_AVAILABLE;
+
if (mDescriptor->CacheEntry()) {
nsAutoCString uncompressedLenStr;
rv = mDescriptor->GetMetaDataElement("uncompressed-len",