2014-10-30 14:45:21 +01:00
|
|
|
Patch-Mainline: To be upstreamed
|
|
|
|
References: bnc#900896 CVE-2014-8240
|
|
|
|
Signed-off-by: Michal Srb <msrb@suse.com>
|
|
|
|
|
2017-05-31 13:59:52 +02:00
|
|
|
Index: tigervnc-1.8.0/unix/x0vncserver/Image.cxx
|
2015-01-09 14:08:09 +01:00
|
|
|
===================================================================
|
2017-05-31 13:59:52 +02:00
|
|
|
--- tigervnc-1.8.0.orig/unix/x0vncserver/Image.cxx
|
|
|
|
+++ tigervnc-1.8.0/unix/x0vncserver/Image.cxx
|
2014-10-30 14:45:21 +01:00
|
|
|
@@ -80,6 +80,14 @@ void Image::Init(int width, int height)
|
|
|
|
xim = XCreateImage(dpy, vis, DefaultDepth(dpy, DefaultScreen(dpy)),
|
|
|
|
ZPixmap, 0, 0, width, height, BitmapPad(dpy), 0);
|
|
|
|
|
|
|
|
+ if (xim->bytes_per_line <= 0 ||
|
|
|
|
+ xim->height <= 0 ||
|
|
|
|
+ xim->height >= INT_MAX / xim->bytes_per_line) {
|
|
|
|
+ vlog.error("Invalid display size");
|
|
|
|
+ XDestroyImage(xim);
|
|
|
|
+ exit(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
xim->data = (char *)malloc(xim->bytes_per_line * xim->height);
|
|
|
|
if (xim->data == NULL) {
|
|
|
|
vlog.error("malloc() failed");
|
|
|
|
@@ -254,6 +262,17 @@ void ShmImage::Init(int width, int heigh
|
|
|
|
delete shminfo;
|
|
|
|
shminfo = NULL;
|
|
|
|
return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (xim->bytes_per_line <= 0 ||
|
|
|
|
+ xim->height <= 0 ||
|
|
|
|
+ xim->height >= INT_MAX / xim->bytes_per_line) {
|
|
|
|
+ vlog.error("Invalid display size");
|
|
|
|
+ XDestroyImage(xim);
|
|
|
|
+ xim = NULL;
|
|
|
|
+ delete shminfo;
|
|
|
|
+ shminfo = NULL;
|
|
|
|
+ return;
|
|
|
|
}
|
|
|
|
|
|
|
|
shminfo->shmid = shmget(IPC_PRIVATE,
|