From: Jean Delvare <jdelvare@suse.com>
Subject: 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>
---
libavfilter/vf_delogo.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
|
old
|
new
|
static av_cold int init(AVFilterContext
|
| 225 | 225 | return 0; |
| 226 | 226 | } |
| 227 | 227 | |
| | 228 | static int config_input(AVFilterLink *inlink) |
| | 229 | { |
| | 230 | DelogoContext *s = inlink->dst->priv; |
| | 231 | |
| | 232 | /* Check whether the logo area fits in the frame */ |
| | 233 | if (s->x + (s->band - 1) < 0 || s->x + s->w - (s->band*2 - 2) > inlink->w || |
| | 234 | s->y + (s->band - 1) < 0 || s->y + s->h - (s->band*2 - 2) > inlink->h) { |
| | 235 | av_log(s, AV_LOG_ERROR, "Logo area is outside of the frame.\n"); |
| | 236 | return AVERROR(EINVAL); |
| | 237 | } |
| | 238 | |
| | 239 | return 0; |
| | 240 | } |
| | 241 | |
| 228 | 242 | static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
| 229 | 243 | { |
| 230 | 244 | DelogoContext *s = inlink->dst->priv; |
| … |
… |
static const AVFilterPad avfilter_vf_del
|
| 283 | 297 | .name = "default", |
| 284 | 298 | .type = AVMEDIA_TYPE_VIDEO, |
| 285 | 299 | .filter_frame = filter_frame, |
| | 300 | .config_props = config_input, |
| 286 | 301 | }, |
| 287 | 302 | { NULL } |
| 288 | 303 | }; |