Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2016-05-10 15:50:38 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-10 19:18:47 +0300
commitaeefe018f847aa46c8d69d1d237a54ef89f58fee (patch)
treeb691fe29241180ba85bdd85057809edfd59d7224 /libavfilter/vf_delogo.c
parent531ff7161d9d6b0cf8f71125319c1f5df5041637 (diff)
avfilter/delogo: Check that logo area is inside the picture
We can only remove the logo if it is inside the picture. We need at least one pixel around the logo area for interpolation. Fixes ticket #5527 (Delogo crash with x=0 and/or y=0). Signed-off-by: Jean Delvare <jdelvare@suse.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter/vf_delogo.c')
-rw-r--r--libavfilter/vf_delogo.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 63c3539467..065d093641 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -226,6 +226,20 @@ static av_cold int init(AVFilterContext *ctx)
return 0;
}
+static int config_input(AVFilterLink *inlink)
+{
+ DelogoContext *s = inlink->dst->priv;
+
+ /* Check whether the logo area fits in the frame */
+ if (s->x + (s->band - 1) < 0 || s->x + s->w - (s->band*2 - 2) > inlink->w ||
+ s->y + (s->band - 1) < 0 || s->y + s->h - (s->band*2 - 2) > inlink->h) {
+ av_log(s, AV_LOG_ERROR, "Logo area is outside of the frame.\n");
+ return AVERROR(EINVAL);
+ }
+
+ return 0;
+}
+
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
{
DelogoContext *s = inlink->dst->priv;
@@ -284,6 +298,7 @@ static const AVFilterPad avfilter_vf_delogo_inputs[] = {
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.filter_frame = filter_frame,
+ .config_props = config_input,
},
{ NULL }
};