diff mbox

[FFmpeg-devel] ffplay -vcodec h264_vda *. error :segmentation fault. bug fix.

Message ID 1479809204-85662-1-git-send-email-gaochao1@gmail.com
State New
Headers show

Commit Message

gao chao Nov. 22, 2016, 10:06 a.m. UTC
---
 libavcodec/vda_h264_dec.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/libavcodec/vda_h264_dec.c b/libavcodec/vda_h264_dec.c
index 92839e2..809c2f4 100644
--- a/libavcodec/vda_h264_dec.c
+++ b/libavcodec/vda_h264_dec.c
@@ -226,12 +226,14 @@  static av_cold int vdadec_init(AVCodecContext *avctx)
     ctx->h264_initialized = 1;
 
     for (i = 0; i < MAX_SPS_COUNT; i++) {
-        const SPS *sps = (const SPS*)ctx->h264ctx.ps.sps_list[i]->data;
-        if (sps && (sps->bit_depth_luma != 8 ||
-                sps->chroma_format_idc == 2 ||
-                sps->chroma_format_idc == 3)) {
-            av_log(avctx, AV_LOG_ERROR, "Format is not supported.\n");
-            goto failed;
+        if (ctx->h264ctx.ps.sps_list[i] != NULL) {
+            const SPS *sps = (const SPS*)ctx->h264ctx.ps.sps_list[i]->data;
+            if (sps && (sps->bit_depth_luma != 8 ||
+                        sps->chroma_format_idc == 2 ||
+                        sps->chroma_format_idc == 3)) {
+                av_log(avctx, AV_LOG_ERROR, "Format is not supported.\n");
+                goto failed;
+            }
         }
     }