Prevent zero sized wl_egl_window

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.
This commit is contained in:
Sinclair Yeh
2014-02-12 16:21:11 -08:00
committed by Kristian Høgsberg
parent 03597cf802
commit 6c9d6898fd

View 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;