[FFmpeg-cvslog] avfilter/vf_pad: Fix segfault if reconfiguration fails

Michael Niedermayer git at videolan.org
Mon Jan 2 19:42:55 EET 2017


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Jan  2 18:19:54 2017 +0100| [3d8a8fd27e63f97bba5fd3da7c3e81c8bc126279] | committer: Michael Niedermayer

avfilter/vf_pad: Fix segfault if reconfiguration fails

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

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

 libavfilter/vf_pad.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index 9739a0f..61927b6 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -210,12 +210,16 @@ static int config_output(AVFilterLink *outlink)
 static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
 {
     PadContext *s = inlink->dst->priv;
-
-    AVFrame *frame = ff_get_video_buffer(inlink->dst->outputs[0],
-                                         w + (s->w - s->in_w),
-                                         h + (s->h - s->in_h) + (s->x > 0));
+    AVFrame *frame;
     int plane;
 
+    if (s->inlink_w <= 0)
+        return NULL;
+
+    frame = ff_get_video_buffer(inlink->dst->outputs[0],
+                                w + (s->w - s->in_w),
+                                h + (s->h - s->in_h) + (s->x > 0));
+
     if (!frame)
         return NULL;
 



More information about the ffmpeg-cvslog mailing list