Prevent zero sized wl_egl_window
authorSinclair Yeh <sinclair.yeh@intel.com>
Thu, 13 Feb 2014 00:21:11 +0000 (16:21 -0800)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 18 Feb 2014 22:12:11 +0000 (14:12 -0800)
It is illegal to create or resize a window to zero (or negative) width
and/or height.  This patch prevents such a request from happening.

src/egl/wayland/wayland-egl/wayland-egl.c

index 8bd49cf6c4fc324e7a193ff2bda58dd27a33a390..ae78595b92cc578fd2e5a47e0a7bf45a29bcdeb1 100644 (file)
@@ -9,6 +9,9 @@ wl_egl_window_resize(struct wl_egl_window *egl_window,
                     int width, int height,
                     int dx, int dy)
 {
+       if (width <= 0 || height <= 0)
+               return;
+
        egl_window->width  = width;
        egl_window->height = height;
        egl_window->dx     = dx;
@@ -24,6 +27,9 @@ wl_egl_window_create(struct wl_surface *surface,
 {
        struct wl_egl_window *egl_window;
 
+       if (width <= 0 || height <= 0)
+               return NULL;
+
        egl_window = malloc(sizeof *egl_window);
        if (!egl_window)
                return NULL;