[PATCH 1/2] wl_shell: check the parameter sent by the clients

juan.j.zhao at intel.com juan.j.zhao at intel.com
Mon Oct 31 00:17:58 PDT 2011


From: Juan Zhao <juan.j.zhao at intel.com>

sometimes the unhealthy clients may send wrong parameter,
the server should not be crashed by these wrong parameters.
---
 compositor/shell.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/compositor/shell.c b/compositor/shell.c
index 50c80e9..8e5d24e 100644
--- a/compositor/shell.c
+++ b/compositor/shell.c
@@ -256,6 +256,16 @@ shell_set_toplevel(struct wl_client *client,
 {
 	struct wlsc_surface *es = surface_resource->data;
 	struct wlsc_compositor *ec = es->compositor;
+        if((struct wl_interface *)
+	     (((struct wl_object *)surface_resource)->interface)->name
+	       !="wl_surface")
+        {
+                if(wl_debug)
+			printf("set wl_buffer to the toplevel 
+				in shell_set_toplevel, return!\n");
+                return;
+        }
+
 
 	if (es->map_type == WLSC_SURFACE_MAP_FULLSCREEN) {
 		es->x = es->saved_x;
-- 
1.7.1



More information about the wayland-devel mailing list