ffmpeg: Fix crash with ost->last_frame allocation failure
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 14 Jul 2015 11:02:19 +0000 (13:02 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Tue, 28 Jul 2015 00:42:16 +0000 (02:42 +0200)
Fixes: 1013dbde2c360d939cc2dfc33e4f275c_signal_sigsegv_a0500f_45_320vp3.nsv with memlimit of 536870912

Found-by: Samuel GroƟ, Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fd4c87fa3becaf8a6c480db915daf51e297b76c5)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
ffmpeg.c

index baaa101..43762ed 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1148,7 +1148,7 @@ static void do_video_out(AVFormatContext *s,
     if (!ost->last_frame)
         ost->last_frame = av_frame_alloc();
     av_frame_unref(ost->last_frame);
-    if (next_picture)
+    if (next_picture && ost->last_frame)
         av_frame_ref(ost->last_frame, next_picture);
     else
         av_frame_free(&ost->last_frame);