cairo-xlib: Check for maximum surface size

This commit is contained in:
Heiko Lewin 2021-01-19 11:07:54 +00:00
commit 01f38097a5
3 changed files with 5 additions and 2 deletions

View file

@ -65,6 +65,8 @@ typedef struct _cairo_xlib_surface cairo_xlib_surface_t;
#define RAMP_SIZE 16
/* maximum number of cached GC's */
#define GC_CACHE_SIZE 4
/* maximum width/height of an X11 drawable */
#define XLIB_COORD_MAX 32767
struct _cairo_xlib_display {
cairo_device_t base;

View file

@ -809,6 +809,9 @@ _cairo_xlib_shm_surface_create (cairo_xlib_surface_t *other,
pixman_image_t *image;
int stride, size;
if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX)
return NULL;
stride = CAIRO_STRIDE_FOR_WIDTH_BPP (width, PIXMAN_FORMAT_BPP(format));
size = stride * height;
if (size < MIN_SIZE)

View file

@ -72,8 +72,6 @@
#include <sys/ipc.h>
#include <sys/shm.h>
#define XLIB_COORD_MAX 32767
#define DEBUG 0
#if DEBUG