[PATCH] Prevent zero sized wl_egl_window

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
+
 	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;
-- 
1.8.1.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux