Blame SOURCES/tigervnc-CVE-2014-0011.patch

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