OSDN Git Service

gen7_mfd: Check ptr before dereferencing
authorfritsch <fritsch@kodi.tv>
Sat, 26 Aug 2017 21:01:56 +0000 (23:01 +0200)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 4 Sep 2017 05:21:58 +0000 (13:21 +0800)
src/gen7_mfd.c

index fe4d66d..1e6911e 100644 (file)
@@ -1681,10 +1681,11 @@ gen7_mfd_vc1_pred_pipe_state(VADriverContextP ctx,
     if (gen7_mfd_context->reference_surface[0].surface_id != VA_INVALID_ID) {
         if (picture_type == 1 || picture_type == 2) { /* P/B picture */
             struct gen7_vc1_surface *gen7_vc1_surface = gen7_mfd_context->reference_surface[0].obj_surface->private_data;
-
-            intensitycomp_single_fwd = gen7_vc1_surface->intensity_compensation;
-            luma_scale1 = gen7_vc1_surface->luma_scale;
-            luma_shift1 = gen7_vc1_surface->luma_shift;
+            if (gen7_vc1_surface) {
+                intensitycomp_single_fwd = gen7_vc1_surface->intensity_compensation;
+                luma_scale1 = gen7_vc1_surface->luma_scale;
+                luma_shift1 = gen7_vc1_surface->luma_shift;
+            }
         }
     }