summaryrefslogtreecommitdiffstats
path: root/netwerk/cache
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 /netwerk/cache
parent4b76d6427a6650a499f8840fb8b054be70dd1c35 (diff)
downloadUXP-093b63034758fa8c85543afd6a93bcf1b6da231e.tar
UXP-093b63034758fa8c85543afd6a93bcf1b6da231e.tar.gz
UXP-093b63034758fa8c85543afd6a93bcf1b6da231e.tar.lz
UXP-093b63034758fa8c85543afd6a93bcf1b6da231e.tar.xz
UXP-093b63034758fa8c85543afd6a93bcf1b6da231e.zip
Fix cache v1 compression crash in nsCompressOutputStreamWrapper::Close()
Diffstat (limited to 'netwerk/cache')
-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 b53ee3058..64765f8aa 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",