Bug 1355661 - Continue inflating even when the Fd was closed, as long as there is still output pending. r?aklotz
This appears to have been "broken" since
bug 510844, for some value of
broken where it doesn't actually cause any problem in practice because
of how zlib behaves.
That is, in practice, we always still have input to process when there's
pending output. But while that's true with zlib, that's not necessarily
true for other decompressors (e.g. brotli).
--- a/modules/libjar/nsJARInputStream.cpp
+++ b/modules/libjar/nsJARInputStream.cpp
@@ -190,17 +190,17 @@ MOZ_WIN_MEM_TRY_BEGIN
case MODE_CLOSED:
return NS_BASE_STREAM_CLOSED;
case MODE_DIRECTORY:
return ReadDirectory(aBuffer, aCount, aBytesRead);
case MODE_INFLATE:
- if (mFd) {
+ if (mZs.total_out < mOutSize) {
rv = ContinueInflate(aBuffer, aCount, aBytesRead);
}
// be aggressive about releasing the file!
// note that sometimes, we will release mFd before we've finished
// deflating - this is because zlib buffers the input
if (mZs.avail_in == 0) {
mFd = nullptr;
}