Enlarge the size of array misc_param
authorXiang, Haihao <haihao.xiang@intel.com>
Thu, 14 Nov 2013 07:48:59 +0000 (15:48 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 3 Dec 2013 04:06:14 +0000 (12:06 +0800)
And check the type before storing misc parameters

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
src/i965_drv_video.c
src/i965_drv_video.h

index 178a0f2..1703dfb 100755 (executable)
@@ -2148,6 +2148,10 @@ i965_encoder_render_misc_parameter_buffer(VADriverContextP ctx,
     assert(obj_buffer->buffer_store->buffer);
 
     param = (VAEncMiscParameterBuffer *)obj_buffer->buffer_store->buffer;
+
+    if (param->type > ARRAY_ELEMS(encode->misc_param))
+        return VA_STATUS_ERROR_INVALID_PARAMETER;
+
     i965_release_buffer_store(&encode->misc_param[param->type]);
     i965_reference_buffer_store(&encode->misc_param[param->type], obj_buffer->buffer_store);
 
index f51f39f..ccf9a59 100644 (file)
@@ -138,7 +138,7 @@ struct encode_state
     int num_slice_params_ext;
     int last_packed_header_type;
 
-    struct buffer_store *misc_param[8];
+    struct buffer_store *misc_param[16];
 
     VASurfaceID current_render_target;
     struct object_surface *input_yuv_object;