vmh264: h264 stream crash when enable debug [1/1]
authormiaohong chen <miaohong.chen@amlogic.com>
Tue, 29 Sep 2020 02:17:51 +0000 (10:17 +0800)
committerMiaohong Chen <miaohong.chen@amlogic.com>
Tue, 29 Sep 2020 09:30:16 +0000 (02:30 -0700)
PD#SWPL-34375

Problem:
Null pointer access lead to crash

Solution:
Add Null pointer detect

Verify:
U212

Change-Id: I9d54d7640dd435b1a47823c26e878441ad05e31a
Signed-off-by: miaohong chen <miaohong.chen@amlogic.com>
drivers/frame_provider/decoder/h264_multi/h264_dpb.c

index 43d4719e25b79b93589c2a76bc96d14122e5f30c..ae485a9d388f41349fa6f609403ac38bcfe51a90 100644 (file)
@@ -2690,12 +2690,17 @@ void dump_dpb(struct DecodedPictureBuffer *p_Dpb, u8 force)
                                "B: poc=%d  ",
                                p_Dpb->fs[i]->frame->bottom_poc);
                }
-               if (p_Dpb->fs[i]->is_used == 3)
-                       dpb_print_cont(p_H264_Dpb->decoder_index,
-                       0,
-                       "F: poc=%d pic_num=%d ",
-                       p_Dpb->fs[i]->frame->poc,
-                       p_Dpb->fs[i]->frame->pic_num);
+               if (p_Dpb->fs[i]->is_used == 3) {
+                       if (p_Dpb->fs[i]->frame != NULL)
+                               dpb_print_cont(p_H264_Dpb->decoder_index,
+                               0,
+                               "F: poc=%d pic_num=%d ",
+                               p_Dpb->fs[i]->frame->poc,
+                               p_Dpb->fs[i]->frame->pic_num);
+                       else
+                               dpb_print_cont(p_H264_Dpb->decoder_index,
+                               0, "fs[%d] frame is null ", i);
+               }
                dpb_print_cont(p_H264_Dpb->decoder_index,
                        0,
                        "G: poc=%d)  ", p_Dpb->fs[i]->poc);
@@ -2716,10 +2721,13 @@ void dump_dpb(struct DecodedPictureBuffer *p_Dpb, u8 force)
                        0,
                        "pre_output(in dispq or displaying)  ");
                if (p_Dpb->fs[i]->is_used == 3) {
-                       if (p_Dpb->fs[i]->frame->non_existing)
+                       if (p_Dpb->fs[i]->frame != NULL && p_Dpb->fs[i]->frame->non_existing)
                                dpb_print_cont(p_H264_Dpb->decoder_index,
                                0,
                                "non_existing  ");
+                       else
+                               dpb_print_cont(p_H264_Dpb->decoder_index,
+                               0, "fs[%d] frame is null ", i);
                }
                dpb_print_cont(p_H264_Dpb->decoder_index,
                        0,