Revision: 4508
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4508&view=rev
Author:   dcommander
Date:     2011-06-18 07:22:01 +0000 (Sat, 18 Jun 2011)

Log Message:
-----------
Fix 3305357 (Enabling custom compression level on client crashes server)

Modified Paths:
--------------
    trunk/common/rdr/ZlibOutStream.cxx

Modified: trunk/common/rdr/ZlibOutStream.cxx
===================================================================
--- trunk/common/rdr/ZlibOutStream.cxx  2011-06-17 20:46:08 UTC (rev 4507)
+++ trunk/common/rdr/ZlibOutStream.cxx  2011-06-18 07:22:01 UTC (rev 4508)
@@ -88,8 +88,6 @@
 //        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 @@
 //                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 @@
 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");
   }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to