summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2016-08-26 09:41:59 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2016-08-26 11:16:07 +0200
commit1f570d542ee7d703cf9f272183115f9df0a92b8c (patch)
tree3609154cc814fd4ebcb1b4cb89cac99108b116f4
parent658d97d00ec2068f5745da65f975ca2e46bdd909 (diff)
downloadmutter-1f570d542ee7d703cf9f272183115f9df0a92b8c.tar.gz
wayland: Survive an unsupported buffer size
If cogl fails to create a texture from the client's given buffer, mutter would raise a fatal error and terminate. As a result, a broken client might kill gnome-shell/mutter and take the entire Wayland session with it. Instead of raising a fatal error in this case, log the cogl error message and send the client an OOM error, so mutter/gnome-shell can survive an unsupported buffer size. https://bugzilla.gnome.org/show_bug.cgi?id=770387
-rw-r--r--src/wayland/meta-wayland-buffer.c4
-rw-r--r--src/wayland/meta-wayland-surface.c9
2 files changed, 12 insertions, 1 deletions
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index 8c41e81e8..b23ca3509 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -106,8 +106,10 @@ meta_wayland_buffer_ensure_texture (MetaWaylandBuffer *buffer)
if (!texture)
{
+ meta_warning ("Could not import pending buffer, ignoring commit: %s\n",
+ catch_error->message);
cogl_error_free (catch_error);
- meta_fatal ("Could not import pending buffer, ignoring commit\n");
+ goto out;
}
buffer->texture = texture;
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 031229d8b..ffa6e2e48 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -735,6 +735,14 @@ apply_pending_state (MetaWaylandSurface *surface,
CoglTexture *texture;
texture = meta_wayland_buffer_ensure_texture (pending->buffer);
+ if (!texture)
+ {
+ wl_resource_post_error (surface->resource, WL_DISPLAY_ERROR_NO_MEMORY,
+ "Failed to create a texture for surface %i",
+ wl_resource_get_id (surface->resource));
+
+ goto cleanup;
+ }
meta_surface_actor_wayland_set_texture (surface_actor_wayland,
texture);
}
@@ -804,6 +812,7 @@ apply_pending_state (MetaWaylandSurface *surface,
}
}
+cleanup:
/* If we have a buffer that we are not using, decrease the use count so it may
* be released if no-one else has a use-reference to it.
*/