mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
Post protocol error on invalid wl_surface scale
Letting the scale be set to 0 causes division by zero errors.
This commit is contained in:
parent
bc048b22fb
commit
69b9e2ae8f
1 changed files with 5 additions and 0 deletions
|
@ -459,6 +459,11 @@ static void surface_set_buffer_transform(struct wl_client *client,
|
|||
static void surface_set_buffer_scale(struct wl_client *client,
|
||||
struct wl_resource *resource,
|
||||
int32_t scale) {
|
||||
if (scale <= 0) {
|
||||
wl_resource_post_error(resource, WL_SURFACE_ERROR_INVALID_SCALE,
|
||||
"Specified scale value (%d) is not positive", scale);
|
||||
return;
|
||||
}
|
||||
struct wlr_surface *surface = wlr_surface_from_resource(resource);
|
||||
surface->pending.committed |= WLR_SURFACE_STATE_SCALE;
|
||||
surface->pending.scale = scale;
|
||||
|
|
Loading…
Reference in a new issue