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)
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]);