[FFmpeg-cvslog] avformat/gif: abort early if nothing was written yet

Paul B Mahol git at videolan.org
Wed May 29 12:01:54 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed May 29 10:57:18 2019 +0200| [02333fe394f0c15b1e8bbd3399316578ee8c2334] | committer: Paul B Mahol

avformat/gif: abort early if nothing was written yet

Fixes crash when writting trailer without any previous packets.

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

 libavformat/gif.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/gif.c b/libavformat/gif.c
index 7916ba1e6b..e125d386bd 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -174,6 +174,9 @@ static int gif_write_trailer(AVFormatContext *s)
     GIFContext *gif = s->priv_data;
     AVIOContext *pb = s->pb;
 
+    if (!gif->prev_pkt)
+        return AVERROR(EINVAL);
+
     gif_write_packet(s, NULL);
 
     if (!gif->have_end)



More information about the ffmpeg-cvslog mailing list