[Libva] [PATCH libva-intel-driver] Fix bound checking

Xiang, Haihao haihao.xiang at intel.com
Mon Apr 14 19:20:31 PDT 2014


From: "Xiang, Haihao" <haihao.xiang at intel.com>

Otherwise it might result in buffer overflow.

Signed-off-by: Xiang, Haihao <haihao.xiang at intel.com>
---
 src/i965_drv_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index cc61ad3..9fa85af 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -2326,7 +2326,7 @@ i965_encoder_render_misc_parameter_buffer(VADriverContextP ctx,
 
     param = (VAEncMiscParameterBuffer *)obj_buffer->buffer_store->buffer;
 
-    if (param->type > ARRAY_ELEMS(encode->misc_param))
+    if (param->type >= ARRAY_ELEMS(encode->misc_param))
         return VA_STATUS_ERROR_INVALID_PARAMETER;
 
     i965_release_buffer_store(&encode->misc_param[param->type]);
-- 
1.8.3.2



More information about the Libva mailing list