diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-13 16:13:22 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-14 16:51:01 +0100 |
commit | 4aa876f2880c0252b547e0de9c2ca1034d6120d9 (patch) | |
tree | d53b55d6e4e7e437af69668f34981201eef4e8b2 | |
parent | a9ce4583dfbb65dc2d0d7483f11c6e71b413bac8 (diff) | |
download | ffmpeg-4aa876f2880c0252b547e0de9c2ca1034d6120d9.tar.gz |
avformat/mxfenc: Do not crash if there is no packet in the first stream
Fixes: Ticket4914
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit b51e7554e74cbf007a1cab83c7bed3ad9fa2793a)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mxfenc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index db7d2bf455..319d3c7e4d 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2448,6 +2448,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; } |