[FFmpeg-cvslog] avformat/ivfenc: fix division by zero

Michael Niedermayer git at videolan.org
Fri Jan 15 16:23:52 CET 2016


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Fri Jan  8 23:01:30 2016 +0100| [d79b6dd9f9f7786e7b21f3b8ccdb7c40daa1a147] | committer: Michael Niedermayer

avformat/ivfenc: fix division by zero

Fixes Ticket 5115

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 5c8467a07c654f6acd9e8e3a436cd5b746bb2f44)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d79b6dd9f9f7786e7b21f3b8ccdb7c40daa1a147
---

 libavformat/ivfenc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index 2053c50..484d87d 100644
--- a/libavformat/ivfenc.c
+++ b/libavformat/ivfenc.c
@@ -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);



More information about the ffmpeg-cvslog mailing list