зеркало из https://github.com/mozilla/pjs.git
Bug 712277 - Avoid crash in zlib adler32 following compression failure; r=michal.novotny
This commit is contained in:
Родитель
d2eff92f29
Коммит
d72e4268d0
|
@ -915,6 +915,8 @@ nsCompressOutputStreamWrapper::Write(const char * buf,
|
||||||
while (mZstream.avail_in > 0) {
|
while (mZstream.avail_in > 0) {
|
||||||
zerr = deflate(&mZstream, Z_NO_FLUSH);
|
zerr = deflate(&mZstream, Z_NO_FLUSH);
|
||||||
if (zerr == Z_STREAM_ERROR) {
|
if (zerr == Z_STREAM_ERROR) {
|
||||||
|
deflateEnd(&mZstream);
|
||||||
|
mStreamInitialized = PR_FALSE;
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
// Note: Z_BUF_ERROR is non-fatal and sometimes expected here.
|
// Note: Z_BUF_ERROR is non-fatal and sometimes expected here.
|
||||||
|
@ -924,6 +926,8 @@ nsCompressOutputStreamWrapper::Write(const char * buf,
|
||||||
if (mZstream.avail_out == 0) {
|
if (mZstream.avail_out == 0) {
|
||||||
rv = WriteBuffer();
|
rv = WriteBuffer();
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
|
deflateEnd(&mZstream);
|
||||||
|
mStreamInitialized = PR_FALSE;
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче