mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-02-17 19:00:47 +01:00
Fix error check for zlib calls
There are multiple "okay" return values, not just Z_OK. Make sure we don't bail out needlessly.
This commit is contained in:
parent
49f9ce8e5b
commit
f38e474993
@ -141,7 +141,7 @@ bool ZlibInStream::decompress(bool wait)
|
|||||||
zs->avail_in = bytesIn;
|
zs->avail_in = bytesIn;
|
||||||
|
|
||||||
int rc = inflate(zs, Z_SYNC_FLUSH);
|
int rc = inflate(zs, Z_SYNC_FLUSH);
|
||||||
if (rc != Z_OK) {
|
if (rc < 0) {
|
||||||
throw Exception("ZlibInStream: inflate failed");
|
throw Exception("ZlibInStream: inflate failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ void ZlibOutStream::deflate(int flush)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
rc = ::deflate(zs, flush);
|
rc = ::deflate(zs, flush);
|
||||||
if (rc != Z_OK) {
|
if (rc < 0) {
|
||||||
// Silly zlib returns an error if you try to flush something twice
|
// Silly zlib returns an error if you try to flush something twice
|
||||||
if ((rc == Z_BUF_ERROR) && (flush != Z_NO_FLUSH))
|
if ((rc == Z_BUF_ERROR) && (flush != Z_NO_FLUSH))
|
||||||
break;
|
break;
|
||||||
@ -190,7 +190,7 @@ void ZlibOutStream::checkCompressionLevel()
|
|||||||
deflate(Z_SYNC_FLUSH);
|
deflate(Z_SYNC_FLUSH);
|
||||||
|
|
||||||
rc = deflateParams (zs, newLevel, Z_DEFAULT_STRATEGY);
|
rc = deflateParams (zs, newLevel, Z_DEFAULT_STRATEGY);
|
||||||
if (rc != Z_OK) {
|
if (rc < 0) {
|
||||||
// The implicit flush can result in this error, caused by the
|
// The implicit flush can result in this error, caused by the
|
||||||
// explicit flush we did above. It should be safe to ignore though
|
// explicit flush we did above. It should be safe to ignore though
|
||||||
// as the first flush should have left things in a stable state...
|
// as the first flush should have left things in a stable state...
|
||||||
|
Loading…
Reference in New Issue
Block a user