forked from pool/tigervnc
Stefan Dirsch
478a217a95
* update to current git master in order to fix boo#1132901 >>>>>>> ./tigervnc.changes.r85a118aa653f1d42c31302a788064076 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/tigervnc?expand=0&rev=161
42 lines
1.2 KiB
Diff
42 lines
1.2 KiB
Diff
Patch-Mainline: To be upstreamed
|
|
References: bnc#900896 CVE-2014-8240
|
|
Signed-off-by: Michal Srb <msrb@suse.com>
|
|
|
|
Index: b/unix/x0vncserver/Image.cxx
|
|
===================================================================
|
|
--- a/unix/x0vncserver/Image.cxx
|
|
+++ b/unix/x0vncserver/Image.cxx
|
|
@@ -82,6 +82,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");
|
|
@@ -257,6 +265,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,
|