summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThong Thai <thong.thai@amd.com>2023-05-11 15:10:55 -0400
committerMarge Bot <emma+marge@anholt.net>2023-05-16 21:24:15 +0000
commit04699cc3aa1c3037b4b6d15f88e5157d31adda1a (patch)
treeab834cd92f7244d3f216d656e9ba83644681bfd5
parent63c501809e1bc3e97013e49144985243249a13d5 (diff)
downloadmesa-04699cc3aa1c3037b4b6d15f88e5157d31adda1a.tar.gz
frontends/va/context: return error if context_id == 0
When destroying a context, check the context_id, preventing the handle_table_get function from producing the following error: handle_table_get: Assertion `handle' failed. Cc: stable Signed-off-by: Thong Thai <thong.thai@amd.com> Tested-by: David Heidelberg <david.heidelberg@collabora.com> Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22970>
-rw-r--r--src/gallium/frontends/va/context.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gallium/frontends/va/context.c b/src/gallium/frontends/va/context.c
index c733509dbb6..6e6e907b63f 100644
--- a/src/gallium/frontends/va/context.c
+++ b/src/gallium/frontends/va/context.c
@@ -382,6 +382,9 @@ vlVaDestroyContext(VADriverContextP ctx, VAContextID context_id)
if (!ctx)
return VA_STATUS_ERROR_INVALID_CONTEXT;
+ if (context_id == 0)
+ return VA_STATUS_ERROR_INVALID_CONTEXT;
+
drv = VL_VA_DRIVER(ctx);
mtx_lock(&drv->mutex);
context = handle_table_get(drv->htab, context_id);