[PATCH] Prevent zero sized wl_egl_window (original) (raw)

Pekka Paalanen ppaalanen at gmail.com
Thu Feb 13 00:11:09 PST 2014


On Wed, 12 Feb 2014 16:21:11 -0800 Sinclair Yeh <sinclair.yeh at intel.com> wrote:

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 | 6 ++++++ 1 file changed, 6 insertions(+)

diff --git a/src/egl/wayland/wayland-egl/wayland-egl.c b/src/egl/wayland/wayland-egl/wayland-egl.c index 8bd49cf..ae78595 100644 --- a/src/egl/wayland/wayland-egl/wayland-egl.c +++ b/src/egl/wayland/wayland-egl/wayland-egl.c @@ -9,6 +9,9 @@ wleglwindowresize(struct wleglwindow *eglwindow, int width, int height, int dx, int dy) { + if (width <= 0 || height <= 0) + return; +

The below seems fine, but I wonder if we could make this one cause an error to be returned later where we can, rather than silently ignoring. I'm not sure where or how, though.

Surely drivers have maximum size limits, too, those must be catched somewhere already.

eglwindow->width = width; eglwindow->height = height; eglwindow->dx = dx; @@ -24,6 +27,9 @@ wleglwindowcreate(struct wlsurface *surface, { struct wleglwindow *eglwindow;

+ if (width <= 0 || height <= 0) + return NULL; + eglwindow = malloc(sizeof *eglwindow); if (!eglwindow) return NULL;

Thanks, pq



More information about the dri-devel mailing list