[Mesa-dev] [PATCH v5 08/10] st/va: add more errors checks in vlVaBufferSetNumElements and vlVaMapBuffer

Julien Isorce j.isorce at samsung.com
Fri Oct 30 04:42:51 PDT 2015


Signed-off-by: Julien Isorce <j.isorce at samsung.com>
---
 src/gallium/state_trackers/va/buffer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/state_trackers/va/buffer.c b/src/gallium/state_trackers/va/buffer.c
index 8f9ba44..f5b9e81 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;
-- 
1.9.1



More information about the mesa-dev mailing list