aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/ivfenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-08 23:01:30 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-15 12:30:40 +0100
commitd79b6dd9f9f7786e7b21f3b8ccdb7c40daa1a147 (patch)
tree0cbb4dbdce705e4400e10aecfb2bce8918b22359 /libavformat/ivfenc.c
parent36861557a7a68233c1c2f1569c5d34d6f6bf3966 (diff)
downloadffmpeg-d79b6dd9f9f7786e7b21f3b8ccdb7c40daa1a147.tar.gz
avformat/ivfenc: fix division by zero
Fixes Ticket 5115 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 5c8467a07c654f6acd9e8e3a436cd5b746bb2f44) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/ivfenc.c')
-rw-r--r--libavformat/ivfenc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/ivfenc.c b/libavformat/ivfenc.c
index 2053c509f9..484d87d093 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);