[Libva] [Libva-Intel-Driver][PATCH V2 1/2] VPP: Check the VPP pipeline_parameter to avoid NULL pointer

Zhao Yakui yakui.zhao at intel.com
Wed Aug 10 04:30:12 UTC 2016


This is to fix the crash issue caused by the commit
51ad826fcc0d2512f7ef74e807e4b8526663fc28.

Reported-by: Xu,Guangxin <guangxin.xu at itnel.com>
Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
---
 src/gen75_vpp_vebox.c | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/gen75_vpp_vebox.c b/src/gen75_vpp_vebox.c
index 566f337..2bc5cf9 100644
--- a/src/gen75_vpp_vebox.c
+++ b/src/gen75_vpp_vebox.c
@@ -1379,10 +1379,29 @@ int hsw_veb_pre_format_convert(VADriverContextP ctx,
 
     proc_ctx->format_convert_flags = 0;
 
-    proc_ctx->width_input   = proc_ctx->pipeline_param->surface_region->width;
-    proc_ctx->height_input  = proc_ctx->pipeline_param->surface_region->height;
-    proc_ctx->width_output  = proc_ctx->pipeline_param->output_region->width;
-    proc_ctx->height_output = proc_ctx->pipeline_param->output_region->height;
+    if ((obj_surf_input == NULL) &&
+        (proc_ctx->pipeline_param->surface_region == NULL))
+        assert(0);
+
+    if ((obj_surf_output == NULL) &&
+        (proc_ctx->pipeline_param->output_region == NULL))
+        assert(0);
+
+    if (proc_ctx->pipeline_param->surface_region) {
+        proc_ctx->width_input   = proc_ctx->pipeline_param->surface_region->width;
+        proc_ctx->height_input  = proc_ctx->pipeline_param->surface_region->height;
+    } else {
+        proc_ctx->width_input   = obj_surf_input->orig_width;
+        proc_ctx->height_input  = obj_surf_input->orig_height;
+    }
+
+    if (proc_ctx->pipeline_param->output_region) {
+        proc_ctx->width_output  = proc_ctx->pipeline_param->output_region->width;
+        proc_ctx->height_output = proc_ctx->pipeline_param->output_region->height;
+    } else {
+        proc_ctx->width_output  = obj_surf_output->orig_width;
+        proc_ctx->height_output = obj_surf_output->orig_height;
+    }
 
     /* only partial frame is not supported to be processed */
     /*
-- 
1.9.1



More information about the Libva mailing list