summaryrefslogtreecommitdiff
path: root/src/i965_drv_video.c
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2013-10-15 11:04:00 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-11-13 15:33:21 +0800
commitd68025cd2000ea6b195b24e03acff838572c223e (patch)
tree75432f4fe55521544d15a3f5b4492a0f225db827 /src/i965_drv_video.c
parentdaede78837ea4384df4c10dce9f7fabef4f31a17 (diff)
downloadlibva-intel-driver-d68025cd2000ea6b195b24e03acff838572c223e.tar.gz
libva-intel-driver-d68025cd2000ea6b195b24e03acff838572c223e.tar.bz2
libva-intel-driver-d68025cd2000ea6b195b24e03acff838572c223e.zip
Return the error instead of assert in vaEndPicture
This is to fix the crash issue caused by the incorrect parameter. Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> (cherry picked from commit 1cee858036a87837deddc87586701ed869f96261)
Diffstat (limited to 'src/i965_drv_video.c')
-rwxr-xr-xsrc/i965_drv_video.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
index 6b81fb0..efe72b4 100755
--- a/src/i965_drv_video.c
+++ b/src/i965_drv_video.c
@@ -2313,17 +2313,33 @@ i965_EndPicture(VADriverContextP ctx, VAContextID context)
} else if (obj_context->codec_type == CODEC_ENC) {
assert(VAEntrypointEncSlice == obj_config->entrypoint);
- assert(obj_context->codec_state.encode.pic_param ||
- obj_context->codec_state.encode.pic_param_ext);
- assert(obj_context->codec_state.encode.seq_param ||
- obj_context->codec_state.encode.seq_param_ext);
- assert(obj_context->codec_state.encode.num_slice_params >= 1 ||
- obj_context->codec_state.encode.num_slice_params_ext >= 1);
+ if (!(obj_context->codec_state.encode.pic_param ||
+ obj_context->codec_state.encode.pic_param_ext)) {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ if (!(obj_context->codec_state.encode.seq_param ||
+ obj_context->codec_state.encode.seq_param_ext)) {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ if ((obj_context->codec_state.encode.num_slice_params <=0) &&
+ (obj_context->codec_state.encode.num_slice_params_ext <=0)) {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
} else {
- assert(obj_context->codec_state.decode.pic_param);
- assert(obj_context->codec_state.decode.num_slice_params >= 1);
- assert(obj_context->codec_state.decode.num_slice_datas >= 1);
- assert(obj_context->codec_state.decode.num_slice_params == obj_context->codec_state.decode.num_slice_datas);
+ if (obj_context->codec_state.decode.pic_param == NULL) {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ if (obj_context->codec_state.decode.num_slice_params <=0) {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+ if (obj_context->codec_state.decode.num_slice_datas <=0) {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
+
+ if (obj_context->codec_state.decode.num_slice_params !=
+ obj_context->codec_state.decode.num_slice_datas) {
+ return VA_STATUS_ERROR_INVALID_PARAMETER;
+ }
}
assert(obj_context->hw_context->run);