avformat/ivfenc: fix division by zero
authorMichael Niedermayer <michael@niedermayer.cc>
Fri, 8 Jan 2016 22:01:30 +0000 (23:01 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 8 Jan 2016 22:27:10 +0000 (23:27 +0100)
Fixes Ticket 5115

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/ivfenc.c

index 2053c50..484d87d 100644 (file)
@@ -72,8 +72,9 @@ static int ivf_write_packet(AVFormatContext *s, AVPacket *pkt)
 static int ivf_write_trailer(AVFormatContext *s)
 {
     AVIOContext *pb = s->pb;
-    if (pb->seekable) {
-        IVFEncContext *ctx = s->priv_data;
+    IVFEncContext *ctx = s->priv_data;
+
+    if (pb->seekable && ctx->frame_cnt > 1) {
         size_t end = avio_tell(pb);
 
         avio_seek(pb, 24, SEEK_SET);