From 5e763aaa21654d0591b7da14c573fc03d4a60205 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Fri, 30 Oct 2015 11:42:51 +0000 Subject: st/va: add more errors checks in vlVaBufferSetNumElements and vlVaMapBuffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julien Isorce Reviewed-by: Christian König --- src/gallium/state_trackers/va/buffer.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gallium') diff --git a/src/gallium/state_trackers/va/buffer.c b/src/gallium/state_trackers/va/buffer.c index 8f9ba440a75..f5b9e814c3a 100644 --- a/src/gallium/state_trackers/va/buffer.c +++ b/src/gallium/state_trackers/va/buffer.c @@ -73,6 +73,9 @@ vlVaBufferSetNumElements(VADriverContextP ctx, VABufferID buf_id, return VA_STATUS_ERROR_INVALID_CONTEXT; buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, buf_id); + if (!buf) + return VA_STATUS_ERROR_INVALID_BUFFER; + buf->data = REALLOC(buf->data, buf->size * buf->num_elements, buf->size * num_elements); buf->num_elements = num_elements; @@ -91,6 +94,9 @@ vlVaMapBuffer(VADriverContextP ctx, VABufferID buf_id, void **pbuff) if (!ctx) return VA_STATUS_ERROR_INVALID_CONTEXT; + if (!pbuff) + return VA_STATUS_ERROR_INVALID_PARAMETER; + buf = handle_table_get(VL_VA_DRIVER(ctx)->htab, buf_id); if (!buf) return VA_STATUS_ERROR_INVALID_BUFFER; -- cgit v1.2.3