summaryrefslogtreecommitdiffstats
path: root/libavcodec/vda_h264_dec.c
diff options
context:
space:
mode:
authorXidorn Quan <quanxunzhen@gmail.com>2013-12-27 00:05:36 +1100
committerXidorn Quan <quanxunzhen@gmail.com>2013-12-27 00:06:11 +1100
commit344d6db978af251e32b886f4c54e993771004fc0 (patch)
tree3238ceb609ea0fb545e89946124aed1148ab765f /libavcodec/vda_h264_dec.c
parent14bec7dcf8299f35fff1e2158c6cb8c6d6b2e083 (diff)
downloadffmpeg-streaming-344d6db978af251e32b886f4c54e993771004fc0.zip
ffmpeg-streaming-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.
Diffstat (limited to 'libavcodec/vda_h264_dec.c')
-rw-r--r--libavcodec/vda_h264_dec.c10
1 files changed, 10 insertions, 0 deletions
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:
OpenPOWER on IntegriCloud