summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2014-05-30 12:07:15 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-06-03 09:19:20 +0300
commita55f139d3ccf4b4509720cc02d3f80a41cbf00ac (patch)
tree02cc67950e6ea0187df250625c9c63910510db46
parent6d1d1121a58b19db6e4a60939cbede1fed3d93e2 (diff)
compositor: raise errors when bad scale or transform values are used
-rw-r--r--src/compositor.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/compositor.c b/src/compositor.c
index 574db2de..3c5c8e32 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2138,6 +2138,16 @@ surface_set_buffer_transform(struct wl_client *client,
{
struct weston_surface *surface = wl_resource_get_user_data(resource);
+ /* if wl_output.transform grows more members this will need to be updated. */
+ if (transform < 0 ||
+ transform > WL_OUTPUT_TRANSFORM_FLIPPED_270) {
+ wl_resource_post_error(resource,
+ WL_SURFACE_ERROR_INVALID_TRANSFORM,
+ "buffer transform must be a valid transform "
+ "('%d' specified)", transform);
+ return;
+ }
+
surface->pending.buffer_viewport.buffer.transform = transform;
}
@@ -2148,6 +2158,14 @@ surface_set_buffer_scale(struct wl_client *client,
{
struct weston_surface *surface = wl_resource_get_user_data(resource);
+ if (scale < 1) {
+ wl_resource_post_error(resource,
+ WL_SURFACE_ERROR_INVALID_SCALE,
+ "buffer scale must be at least one "
+ "('%d' specified)", scale);
+ return;
+ }
+
surface->pending.buffer_viewport.buffer.scale = scale;
}