Bug 1235945 - Fix assertion error in some cases when running szip when debug flags are enabled for host tools. r=froydnj

This commit is contained in:
Mike Hommey 2015-12-31 10:08:13 +09:00
Родитель ae7a25d2a4
Коммит 20a9c9e220
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -425,7 +425,11 @@ int SzipCompress::do_compress(Buffer &origBuf, Buffer &outBuf,
zStream.avail_in = avail;
zStream.next_in = data;
ret = deflate(&zStream, Z_FINISH);
MOZ_ASSERT(ret == Z_STREAM_END);
/* Under normal conditions, deflate returns Z_STREAM_END. If there is not
* enough room to compress, deflate returns Z_OK and avail_out is 0. We
* still want to deflateEnd in that case, so fall through. It will bail
* on the avail_out test that follows. */
MOZ_ASSERT(ret == Z_STREAM_END || ret == Z_OK);
ret = deflateEnd(&zStream);
MOZ_ASSERT(ret == Z_OK);
if (zStream.avail_out <= 0)