diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-10-16 19:21:00 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-10-16 19:29:56 +0200 |
commit | 1e35519fe0b8bbad84641e83d49138152720b544 (patch) | |
tree | f3badb9d95cabc436e01074a121492904c954cc7 /libavfilter/vf_gblur.c | |
parent | c70d547751cb3b536f9bca8b060d94f527695b71 (diff) | |
download | ffmpeg-1e35519fe0b8bbad84641e83d49138152720b544.tar.gz |
avfilter/vf_gblur: fix undefined behaviour
Fixes #8292
Diffstat (limited to 'libavfilter/vf_gblur.c')
-rw-r--r-- | libavfilter/vf_gblur.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavfilter/vf_gblur.c b/libavfilter/vf_gblur.c index 9b3e168b1d..803d3e3df4 100644 --- a/libavfilter/vf_gblur.c +++ b/libavfilter/vf_gblur.c @@ -157,6 +157,7 @@ static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_j { GBlurContext *s = ctx->priv; ThreadData *td = arg; + const float max = (1 << s->depth) - 1; const int height = td->height; const int width = td->width; const int64_t numpixels = width * (int64_t)height; @@ -166,8 +167,10 @@ static int filter_postscale(AVFilterContext *ctx, void *arg, int jobnr, int nb_j float *buffer = s->buffer; unsigned i; - for (i = slice_start; i < slice_end; i++) + for (i = slice_start; i < slice_end; i++) { buffer[i] *= postscale; + buffer[i] = av_clipf(buffer[i], 0.f, max); + } return 0; } |