From 3d8a8fd27e63f97bba5fd3da7c3e81c8bc126279 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 2 Jan 2017 18:19:54 +0100 Subject: avfilter/vf_pad: Fix segfault if reconfiguration fails Signed-off-by: Michael Niedermayer --- libavfilter/vf_pad.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'libavfilter/vf_pad.c') diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c index 9739a0fdf6..61927b654a 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; -- cgit v1.2.3