[FFmpeg-cvslog] lavc/h264_mp4toannexb: improve feedback in case of invalid bitstream

Stefano Sabatini git at videolan.org
Wed Jul 17 01:27:42 CEST 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Sun Jul 14 18:26:00 2013 +0200| [53c853e0491691d4ee6f33e6348da2ffc7d345d8] | committer: Stefano Sabatini

lavc/h264_mp4toannexb: improve feedback in case of invalid bitstream

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

 libavcodec/h264_mp4toannexb_bsf.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_mp4toannexb_bsf.c b/libavcodec/h264_mp4toannexb_bsf.c
index eeb67e4..6ca0100 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);
         }



More information about the ffmpeg-cvslog mailing list