Commit b0a20b28 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Prevent setting invalid buffer transform and scale

At the moment, it is possible to crash the compositor if some client
sets a buffer scale less than 1.
parent 40470538
......@@ -349,14 +349,22 @@ void SurfaceInterfacePrivate::surface_commit(Resource *resource)
void SurfaceInterfacePrivate::surface_set_buffer_transform(Resource *resource, int32_t transform)
if (transform < 0 || transform > WL_OUTPUT_TRANSFORM_FLIPPED_270) {
wl_resource_post_error(resource->handle, error_invalid_transform,
"buffer transform must be a valid transform (%d specified)", transform);
pending.bufferTransform = OutputInterface::Transform(transform);
pending.bufferTransformIsSet = true;
void SurfaceInterfacePrivate::surface_set_buffer_scale(Resource *resource, int32_t scale)
if (scale < 1) {
wl_resource_post_error(resource->handle, error_invalid_scale,
"buffer scale must be at least one (%d specified)", scale);
pending.bufferScale = scale;
pending.bufferScaleIsSet = true;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment