From 04699cc3aa1c3037b4b6d15f88e5157d31adda1a Mon Sep 17 00:00:00 2001 From: Thong Thai Date: Thu, 11 May 2023 15:10:55 -0400 Subject: 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 Tested-by: David Heidelberg Reviewed-by: Boyuan Zhang Part-of: --- src/gallium/frontends/va/context.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- cgit v1.2.1