aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-12-13 16:13:22 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-31 00:25:19 +0100
commitfc0f08f9fb5ef5d21f0790a71152a614c4fe7d72 (patch)
treee4af4c21beec4003b942c1857d1806ed0cd1867d /libavformat
parenta2966c7d1f1411ab341baae9533a6bc8e83c678a (diff)
downloadffmpeg-fc0f08f9fb5ef5d21f0790a71152a614c4fe7d72.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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mxfenc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c
index 3c0283b502..7ffd6b65f7 100644
--- a/libavformat/mxfenc.c
+++ b/libavformat/mxfenc.c
@@ -2007,6 +2007,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;
}