Fix bound checking
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 15 Apr 2014 02:20:31 +0000 (20:20 -0600)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 23 Apr 2014 06:22:12 +0000 (14:22 +0800)
Otherwise it might result in buffer overflow.

Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 782b8afdda14f000874d8acf51c3e8c490d55773)

src/i965_drv_video.c

index e801a4d..60174b2 100755 (executable)
@@ -2281,7 +2281,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]);