From 9a5ac36b69ede4563e9ecd734141b12ea3280fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Mon, 3 Nov 2014 20:13:36 +0200 Subject: [PATCH] movenc: Require samples before trying to write edts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This avoids a potential crash if writing a fragmented psp mp4 (which probably is only a hypothetical scenario). Signed-off-by: Martin Storsjö --- libavformat/movenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index bb1dc8a301..fa5fdad1d9 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1771,9 +1771,9 @@ static int mov_write_trak_tag(AVIOContext *pb, MOVMuxContext *mov, avio_wb32(pb, 0); /* size */ ffio_wfourcc(pb, "trak"); mov_write_tkhd_tag(pb, mov, track, st); - if (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS || - (track->entry && track->cluster[0].dts) || - is_clcp_track(track)) { + if (track->entry && + (track->mode == MODE_PSP || track->flags & MOV_TRACK_CTTS || + track->cluster[0].dts || is_clcp_track(track))) { if (mov->use_editlist) mov_write_edts_tag(pb, mov, track); // PSP Movies require edts box else if ((track->entry && track->cluster[0].dts) || track->mode == MODE_PSP || is_clcp_track(track))