[FFmpeg-cvslog] avcodec/vda_h264_dec: add format check

Xidorn Quan git at videolan.org
Sun Dec 29 03:35:37 CET 2013


ffmpeg | branch: master | Xidorn Quan <quanxunzhen at gmail.com> | Fri Dec 27 00:05:36 2013 +1100| [344d6db978af251e32b886f4c54e993771004fc0] | committer: Xidorn Quan

avcodec/vda_h264_dec: add format check

Fix crash when using this decoder for unsupported format on some version
of OS X.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=344d6db978af251e32b886f4c54e993771004fc0
---

 libavcodec/vda_h264_dec.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libavcodec/vda_h264_dec.c b/libavcodec/vda_h264_dec.c
index e5fa807..d2ef5dc 100644
--- a/libavcodec/vda_h264_dec.c
+++ b/libavcodec/vda_h264_dec.c
@@ -235,6 +235,16 @@ static av_cold int vdadec_init(AVCodecContext *avctx)
     }
     ctx->h264_initialized = 1;
 
+    for (int i = 0; i < MAX_SPS_COUNT; i++) {
+        SPS *sps = ctx->h264ctx.sps_buffers[i];
+        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;
+        }
+    }
+
     return 0;
 
 failed:



More information about the ffmpeg-cvslog mailing list