diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c index 0027bb210..24d5c0a53 100644 --- a/src/wayland/meta-wayland-subsurface.c +++ b/src/wayland/meta-wayland-subsurface.c @@ -147,7 +147,8 @@ meta_wayland_subsurface_union_geometry (MetaWaylandSubsurface *subsurface, .height = meta_wayland_surface_get_height (surface), }; - meta_rectangle_union (out_geometry, &geometry, out_geometry); + if (surface->buffer_ref.buffer) + meta_rectangle_union (out_geometry, &geometry, out_geometry); META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (surface, subsurface_surface) { diff --git a/src/wayland/meta-wayland-xdg-shell.c b/src/wayland/meta-wayland-xdg-shell.c index 6abfee73b..2b55ae871 100644 --- a/src/wayland/meta-wayland-xdg-shell.c +++ b/src/wayland/meta-wayland-xdg-shell.c @@ -1484,6 +1484,15 @@ xdg_surface_set_window_geometry (struct wl_client *client, MetaWaylandSurface *surface = surface_from_xdg_surface_resource (resource); MetaWaylandSurfaceState *pending; + if (width == 0 || height == 0) + { + g_warning ("Invalid geometry %dx%d+%d+%d set on xdg_surface@%d. Ignoring for " + "now, but this will result in client termination in the future.", + width, height, x, y, + wl_resource_get_id (resource)); + return; + } + pending = meta_wayland_surface_get_pending_state (surface); pending->has_new_geometry = TRUE; pending->new_geometry.x = x; @@ -1581,6 +1590,15 @@ meta_wayland_xdg_surface_post_apply_state (MetaWaylandSurfaceRole *surface_role meta_wayland_shell_surface_determine_geometry (shell_surface, &pending->new_geometry, &priv->geometry); + if (priv->geometry.width == 0 || priv->geometry.height == 0) + { + g_warning ("Invalid window geometry for xdg_surface@%d. Ignoring " + "for now, but this will result in client termination " + "in the future.", + wl_resource_get_id (priv->resource)); + return; + } + priv->has_set_geometry = TRUE; } else if (priv->has_set_geometry)