summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Isorce <j.isorce@samsung.com>2015-10-30 11:42:51 +0000
committerEmil Velikov <emil.l.velikov@gmail.com>2015-11-07 15:17:49 +0000
commit774dd015bd88f1d4cff4d792d15d295e8d7f4d2a (patch)
tree5c260e2d6acf5e60e089ce4d5ea86e7338759d9c
parent507b589685a9f675eea41f584e94250c2d19e8ba (diff)
downloadmesa-774dd015bd88f1d4cff4d792d15d295e8d7f4d2a.tar.gz
st/va: add more errors checks in vlVaBufferSetNumElements and vlVaMapBuffer
Signed-off-by: Julien Isorce <j.isorce@samsung.com> Reviewed-by: Christian König <christian.koenig@amd.com> (cherry picked from commit 5e763aaa21654d0591b7da14c573fc03d4a60205) Nominated-by: Emil Velikov <emil.velikov@collabora.co.uk>
-rw-r--r--src/gallium/state_trackers/va/buffer.c6
1 files changed, 6 insertions, 0 deletions
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;