summaryrefslogtreecommitdiff
path: root/libavfilter/vf_pad.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-01-02 18:19:54 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-01-02 18:42:31 +0100
commit3d8a8fd27e63f97bba5fd3da7c3e81c8bc126279 (patch)
tree3b10b9535ebc5b7a0f1b88f75f036ab96d2358ba /libavfilter/vf_pad.c
parent28307ef7e62874ad5925885af9ccc6423ff83841 (diff)
downloadffmpeg-3d8a8fd27e63f97bba5fd3da7c3e81c8bc126279.tar.gz
avfilter/vf_pad: Fix segfault if reconfiguration fails
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/vf_pad.c')
-rw-r--r--libavfilter/vf_pad.c12
1 files changed, 8 insertions, 4 deletions
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;