1448d9
diff -up tigervnc-1.3.0/common/CMakeLists.txt.CVE-2014-0011 tigervnc-1.3.0/common/CMakeLists.txt
1448d9
--- tigervnc-1.3.0/common/CMakeLists.txt.CVE-2014-0011	2013-07-01 13:42:01.000000000 +0100
1448d9
+++ tigervnc-1.3.0/common/CMakeLists.txt	2014-02-04 16:59:10.840037314 +0000
1448d9
@@ -23,3 +23,6 @@ if(CMAKE_COMPILER_IS_GNUCXX AND (CMAKE_S
1448d9
     set_target_properties(zlib PROPERTIES COMPILE_FLAGS -fPIC)
1448d9
   endif()
1448d9
 endif()
1448d9
+
1448d9
+# Turn asserts on.
1448d9
+set_target_properties(rdr rfb PROPERTIES COMPILE_FLAGS -UNDEBUG)
1448d9
diff -up tigervnc-1.3.0/common/rfb/zrleDecode.h.CVE-2014-0011 tigervnc-1.3.0/common/rfb/zrleDecode.h
1448d9
--- tigervnc-1.3.0/common/rfb/zrleDecode.h.CVE-2014-0011	2013-07-01 13:41:59.000000000 +0100
1448d9
+++ tigervnc-1.3.0/common/rfb/zrleDecode.h	2014-02-04 16:17:00.881565540 +0000
1448d9
@@ -25,9 +25,10 @@
1448d9
 // FILL_RECT          - fill a rectangle with a single colour
1448d9
 // IMAGE_RECT         - draw a rectangle of pixel data from a buffer
1448d9
 
1448d9
+#include <stdio.h>
1448d9
 #include <rdr/InStream.h>
1448d9
 #include <rdr/ZlibInStream.h>
1448d9
-#include <assert.h>
1448d9
+#include <rfb/Exception.h>
1448d9
 
1448d9
 namespace rfb {
1448d9
 
1448d9
@@ -143,7 +144,10 @@ void ZRLE_DECODE (const Rect& r, rdr::In
1448d9
               len += b;
1448d9
             } while (b == 255);
1448d9
 
1448d9
-            assert(len <= end - ptr);
1448d9
+	    if (end - ptr < len) {
1448d9
+	      fprintf (stderr, "ZRLE decode error\n");
1448d9
+	      throw Exception ("ZRLE decode error");
1448d9
+	    }
1448d9
 
1448d9
 #ifdef FAVOUR_FILL_RECT
1448d9
             int i = ptr - buf;
1448d9
@@ -193,7 +197,10 @@ void ZRLE_DECODE (const Rect& r, rdr::In
1448d9
                 len += b;
1448d9
               } while (b == 255);
1448d9
 
1448d9
-              assert(len <= end - ptr);
1448d9
+	      if (end - ptr < len) {
1448d9
+		fprintf (stderr, "ZRLE decode error\n");
1448d9
+		throw Exception ("ZRLE decode error");
1448d9
+	      }
1448d9
             }
1448d9
 
1448d9
             index &= 127;