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.
master
Simon Ser 3 years ago committed by Simon Zeni
parent 8274c85d21
commit 9a4e1095ca

@ -204,6 +204,17 @@ static void params_create_common(struct wl_resource *params_resource,
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.height = height;
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 */
if (!check_import_dmabuf(linux_dmabuf, &attribs)) {
goto err_failed;

Loading…
Cancel
Save