diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-07-14 18:26:00 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-07-17 01:17:32 +0200 |
commit | 53c853e0491691d4ee6f33e6348da2ffc7d345d8 (patch) | |
tree | df70711e0a7d1a578f6801ff2ffd191dde48e83e | |
parent | a80e622924c89df69fb1c225ba432fe12fe6648e (diff) | |
download | ffmpeg-53c853e0491691d4ee6f33e6348da2ffc7d345d8.tar.gz |
lavc/h264_mp4toannexb: improve feedback in case of invalid bitstream
-rw-r--r-- | libavcodec/h264_mp4toannexb_bsf.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c index eeb67e46d7..6ca01007c2 100644 --- a/libavcodec/h264_mp4toannexb_bsf.c +++ b/libavcodec/h264_mp4toannexb_bsf.c @@ -81,9 +81,15 @@ static int h264_extradata_to_annexb(AVCodecContext *avctx, const int padding) unit_size = AV_RB16(extradata); total_size += unit_size + 4; - if (total_size > INT_MAX - padding || - extradata + 2 + unit_size > avctx->extradata + - avctx->extradata_size) { + if (total_size > INT_MAX - padding) { + av_log(avctx, AV_LOG_ERROR, + "Too big extradata size, corrupted stream or invalid MP4/AVCC bitstream\n"); + av_free(out); + return AVERROR(EINVAL); + } + if (extradata + 2 + unit_size > avctx->extradata + avctx->extradata_size) { + av_log(avctx, AV_LOG_ERROR, "Packet header is not contained in global extradata, " + "corrupted stream or invalid MP4/AVCC bitstream\n"); av_free(out); return AVERROR(EINVAL); } |