summaryrefslogtreecommitdiff
path: root/libavfilter/vf_cover_rect.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-05-04 22:33:17 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-05-04 22:33:17 +0200
commitb4cc7d67f564417af5da99c894a305d1fdd75d51 (patch)
tree5e0e40a1cc00885175bed937fb4ee43dc48571f6 /libavfilter/vf_cover_rect.c
parent0eec40b713eee84e2aec8af35ccce059817cad2a (diff)
downloadffmpeg-b4cc7d67f564417af5da99c894a305d1fdd75d51.tar.gz
avfilter/vf_cover_rect: clip rectangle if it is partly outside the input
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_cover_rect.c')
-rw-r--r--libavfilter/vf_cover_rect.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavfilter/vf_cover_rect.c b/libavfilter/vf_cover_rect.c
index 7e1a9f449d..d12807ad53 100644
--- a/libavfilter/vf_cover_rect.c
+++ b/libavfilter/vf_cover_rect.c
@@ -163,6 +163,17 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
return ff_filter_frame(ctx->outputs[0], in);
}
+ if (x < 0) {
+ w += x;
+ x = 0;
+ }
+ if (y < 0) {
+ h += y;
+ y = 0;
+ }
+ w = FFMIN(w, in->width - x);
+ h = FFMIN(h, in->height - y);
+
if (w > in->width || h > in->height || w <= 0 || h <= 0)
return AVERROR(EINVAL);