diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-03 04:26:29 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-03 04:26:29 +0200 |
commit | 093b63034758fa8c85543afd6a93bcf1b6da231e (patch) | |
tree | 1f636335c5cd4c514c44fc72ae46e9e004919a0f | |
parent | 4b76d6427a6650a499f8840fb8b054be70dd1c35 (diff) | |
download | UXP-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()
-rw-r--r-- | netwerk/cache/nsCacheEntryDescriptor.cpp | 6 |
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", |