diff options
author | Xidorn Quan <quanxunzhen@gmail.com> | 2013-12-27 00:05:36 +1100 |
---|---|---|
committer | Xidorn Quan <quanxunzhen@gmail.com> | 2013-12-27 00:06:11 +1100 |
commit | 344d6db978af251e32b886f4c54e993771004fc0 (patch) | |
tree | 3238ceb609ea0fb545e89946124aed1148ab765f | |
parent | 14bec7dcf8299f35fff1e2158c6cb8c6d6b2e083 (diff) | |
download | ffmpeg-344d6db978af251e32b886f4c54e993771004fc0.tar.gz |
avcodec/vda_h264_dec: add format check
Fix crash when using this decoder for unsupported format on some version
of OS X.
-rw-r--r-- | libavcodec/vda_h264_dec.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/vda_h264_dec.c b/libavcodec/vda_h264_dec.c index e5fa8071b3..d2ef5dc9a6 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: |