aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-09-17 13:47:17 +0200
committerPaul B Mahol <onemda@gmail.com>2016-09-17 13:57:45 +0200
commitd790887d1c6ec00d563aedc2f243712815594654 (patch)
tree1a3346ae733291e615ead1f356500deef9c27904
parent27714b462d1bff9e9b40fbdabb39f58e79032b81 (diff)
downloadffmpeg-d790887d1c6ec00d563aedc2f243712815594654.tar.gz
avfilter/vf_unsharp: check if scalebits is too high
Otherwise filter would happily give overflows and produce useless output. Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavfilter/vf_unsharp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index d264e24e3c..aea98509ae 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -141,6 +141,10 @@ static av_cold int init(AVFilterContext *ctx)
set_filter_param(&s->luma, s->lmsize_x, s->lmsize_y, s->lamount);
set_filter_param(&s->chroma, s->cmsize_x, s->cmsize_y, s->camount);
+ if (s->luma.scalebits >= 26 || s->chroma.scalebits >= 26) {
+ av_log(ctx, AV_LOG_ERROR, "luma or chroma matrix size too big\n");
+ return AVERROR(EINVAL);
+ }
s->apply_unsharp = apply_unsharp_c;
if (!CONFIG_OPENCL && s->opencl) {
av_log(ctx, AV_LOG_ERROR, "OpenCL support was not enabled in this build, cannot be selected\n");