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 b51e7554e7)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-12-13 16:13:22 +01:00
parent 50aacb334a
commit 07b9632531
1 changed files with 4 additions and 0 deletions

View File

@ -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;
}