From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Paalanen Subject: Re: [PATCH] Prevent zero sized wl_egl_window Date: Thu, 13 Feb 2014 10:11:09 +0200 Message-ID: <20140213101109.5bf7cb74@gmail.com> References: <1392250871-3224-1-git-send-email-sinclair.yeh@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1392250871-3224-1-git-send-email-sinclair.yeh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: wayland-devel-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Errors-To: wayland-devel-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org To: Sinclair Yeh Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, wayland-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org List-Id: dri-devel@lists.freedesktop.org On Wed, 12 Feb 2014 16:21:11 -0800 Sinclair Yeh 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 @@ wl_egl_window_resize(struct wl_egl_window *egl_window, > 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. > 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; Thanks, pq