[FFmpeg-cvslog] avformat/mxfenc: Do not crash if there is no packet in the first stream

Michael Niedermayer git at videolan.org
Fri Jan 15 17:51:08 CET 2016


ffmpeg | branch: release/2.5 | Michael Niedermayer <michael at niedermayer.cc> | Sun Dec 13 16:13:22 2015 +0100| [07b96325311bcc5f79f02a2ff20e6f54b3c4a459] | committer: Michael Niedermayer

avformat/mxfenc: Do not crash if there is no packet in the first stream

Fixes: Ticket4914

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit b51e7554e74cbf007a1cab83c7bed3ad9fa2793a)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mxfenc.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 36503f3..7607f95 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2122,6 +2122,10 @@ static int mxf_write_packet(AVFormatContext *s, AVPacket *pkt)
         }
         mxf->edit_units_count++;
     } else if (!mxf->edit_unit_byte_count && st->index == 1) {
+        if (!mxf->edit_units_count) {
+            av_log(s, AV_LOG_ERROR, "No packets in first stream\n");
+            return AVERROR_PATCHWELCOME;
+        }
         mxf->index_entries[mxf->edit_units_count-1].slice_offset =
             mxf->body_offset - mxf->index_entries[mxf->edit_units_count-1].offset;
     }



More information about the ffmpeg-cvslog mailing list