mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
linux-dmabuf-v1: properly validate flags
We were send a protocol error if INTERLACED or BOTTOM_FIRST was set. This is incorrect for the zwp_linux_dmabuf_params.create code-path because this kills the client without allowing it to gracefully handle the error. We should only send a protocol error if the client provides a bit not listed in the protocol definition.
This commit is contained in:
parent
8274c85d21
commit
9a4e1095ca
1 changed files with 11 additions and 8 deletions
|
@ -204,6 +204,17 @@ static void params_create_common(struct wl_resource *params_resource,
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* reject unknown flags */
|
||||||
|
uint32_t all_flags = ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT |
|
||||||
|
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_INTERLACED |
|
||||||
|
ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_BOTTOM_FIRST;
|
||||||
|
if (flags & ~all_flags) {
|
||||||
|
wl_resource_post_error(params_resource,
|
||||||
|
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT,
|
||||||
|
"Unknown dmabuf flags %"PRIu32, flags);
|
||||||
|
goto err_out;
|
||||||
|
}
|
||||||
|
|
||||||
attribs.width = width;
|
attribs.width = width;
|
||||||
attribs.height = height;
|
attribs.height = height;
|
||||||
attribs.format = format;
|
attribs.format = format;
|
||||||
|
@ -265,14 +276,6 @@ static void params_create_common(struct wl_resource *params_resource,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reject unknown flags */
|
|
||||||
if (attribs.flags & ~ZWP_LINUX_BUFFER_PARAMS_V1_FLAGS_Y_INVERT) {
|
|
||||||
wl_resource_post_error(params_resource,
|
|
||||||
ZWP_LINUX_BUFFER_PARAMS_V1_ERROR_INVALID_FORMAT,
|
|
||||||
"Unknown dmabuf flags %"PRIu32, attribs.flags);
|
|
||||||
goto err_out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if dmabuf is usable */
|
/* Check if dmabuf is usable */
|
||||||
if (!check_import_dmabuf(linux_dmabuf, &attribs)) {
|
if (!check_import_dmabuf(linux_dmabuf, &attribs)) {
|
||||||
goto err_failed;
|
goto err_failed;
|
||||||
|
|
Loading…
Reference in a new issue