]> git.sesse.net Git - ffmpeg/commitdiff
avformat/gif: abort early if nothing was written yet
authorPaul B Mahol <onemda@gmail.com>
Wed, 29 May 2019 08:57:18 +0000 (10:57 +0200)
committerPaul B Mahol <onemda@gmail.com>
Wed, 29 May 2019 08:57:18 +0000 (10:57 +0200)
Fixes crash when writting trailer without any previous packets.

libavformat/gif.c

index 7916ba1e6b2a9bbaac3b08b6680e6218978d3ed3..e125d386bd2d2dda93278f47167dc6439890d3d8 100644 (file)
@@ -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)