All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pekka Paalanen <ppaalanen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Sinclair Yeh <sinclair.yeh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	wayland-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] Prevent zero sized wl_egl_window
Date: Thu, 13 Feb 2014 10:11:09 +0200	[thread overview]
Message-ID: <20140213101109.5bf7cb74@gmail.com> (raw)
In-Reply-To: <1392250871-3224-1-git-send-email-sinclair.yeh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Wed, 12 Feb 2014 16:21:11 -0800
Sinclair Yeh <sinclair.yeh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> 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

  parent reply	other threads:[~2014-02-13  8:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13  0:21 [PATCH] Prevent zero sized wl_egl_window Sinclair Yeh
     [not found] ` <1392250871-3224-1-git-send-email-sinclair.yeh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-02-13  8:11   ` Pekka Paalanen [this message]
2014-02-13 18:18     ` Yeh, Sinclair
     [not found]       ` <1392315418.3247.29.camel-xjpeL9Jkt2k8a1ujtQqgMq2pdiUAq4bhAL8bYrjMMd8@public.gmane.org>
2014-02-14  7:31         ` Pekka Paalanen
     [not found]           ` <20140214093145.7847a53f-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-18 22:25             ` Kristian Høgsberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140213101109.5bf7cb74@gmail.com \
    --to=ppaalanen-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=sinclair.yeh-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=wayland-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.