diff options
author | DRC <dcommander@users.sourceforge.net> | 2011-06-18 07:22:01 +0000 |
---|---|---|
committer | DRC <dcommander@users.sourceforge.net> | 2011-06-18 07:22:01 +0000 |
commit | 4b187ad6a2f3e794c6819f076536614922bdc8e1 (patch) | |
tree | 2291bf37d6a97c64b5396474595c35cc500cbd75 /common/rdr/ZlibOutStream.cxx | |
parent | ee4074bef241007635b1c732bd9a628d6be1b3dd (diff) | |
download | tigervnc-4b187ad6a2f3e794c6819f076536614922bdc8e1.tar.gz tigervnc-4b187ad6a2f3e794c6819f076536614922bdc8e1.zip |
Fix 3305357 (Enabling custom compression level on client crashes server)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4508 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rdr/ZlibOutStream.cxx')
-rw-r--r-- | common/rdr/ZlibOutStream.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/common/rdr/ZlibOutStream.cxx b/common/rdr/ZlibOutStream.cxx index f60a620b..c39aa55d 100644 --- a/common/rdr/ZlibOutStream.cxx +++ b/common/rdr/ZlibOutStream.cxx @@ -88,8 +88,6 @@ void ZlibOutStream::flush() // fprintf(stderr,"zos flush: calling deflate, avail_in %d, avail_out %d\n", // zs->avail_in,zs->avail_out); checkCompressionLevel(); - int rc = deflate(zs, Z_SYNC_FLUSH); - if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed"); // fprintf(stderr,"zos flush: after deflate: %d bytes\n", // zs->next_out-underlying->getptr()); @@ -122,8 +120,6 @@ int ZlibOutStream::overrun(int itemSize, int nItems) // zs->avail_in,zs->avail_out); checkCompressionLevel(); - int rc = deflate(zs, 0); - if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed"); // fprintf(stderr,"zos overrun: after deflate: %d bytes\n", // zs->next_out-underlying->getptr()); @@ -155,9 +151,15 @@ int ZlibOutStream::overrun(int itemSize, int nItems) void ZlibOutStream::checkCompressionLevel() { if (newLevel != compressionLevel) { - if (deflateParams (zs, newLevel, Z_DEFAULT_STRATEGY) != Z_OK) { + int rc = deflate(zs, Z_SYNC_FLUSH); + if (rc != Z_OK) + throw Exception("ZlibOutStream: deflate failed"); + if (deflateParams (zs, newLevel, Z_DEFAULT_STRATEGY) != Z_OK) throw Exception("ZlibOutStream: deflateParams failed"); - } compressionLevel = newLevel; + } else { + int rc = deflate(zs, Z_SYNC_FLUSH); + if (rc != Z_OK) + throw Exception("ZlibOutStream: deflate failed"); } } |