diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-12-10 14:58:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-10 14:58:13 +0100 |
commit | fa024537a39c24bf9fb2e24063acee0daf63dfc1 (patch) | |
tree | 759ef4154a16f572b0782516d641fbb993ff9400 /thirdparty/libwebp/src/utils/quant_levels_dec_utils.c | |
parent | ca06e656bec5129cc0fc45f83b310976adb752e3 (diff) | |
parent | d4133ac8440321f2ae2e26fb317871bd847b35eb (diff) |
Merge pull request #24258 from volzhs/libwebp-1.0.1
Update libwebp to 1.0.1
Diffstat (limited to 'thirdparty/libwebp/src/utils/quant_levels_dec_utils.c')
-rw-r--r-- | thirdparty/libwebp/src/utils/quant_levels_dec_utils.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/thirdparty/libwebp/src/utils/quant_levels_dec_utils.c b/thirdparty/libwebp/src/utils/quant_levels_dec_utils.c index 3818a78b93..f65b6cdbb6 100644 --- a/thirdparty/libwebp/src/utils/quant_levels_dec_utils.c +++ b/thirdparty/libwebp/src/utils/quant_levels_dec_utils.c @@ -261,9 +261,15 @@ static void CleanupParams(SmoothParams* const p) { int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride, int strength) { - const int radius = 4 * strength / 100; + int radius = 4 * strength / 100; + if (strength < 0 || strength > 100) return 0; if (data == NULL || width <= 0 || height <= 0) return 0; // bad params + + // limit the filter size to not exceed the image dimensions + if (2 * radius + 1 > width) radius = (width - 1) >> 1; + if (2 * radius + 1 > height) radius = (height - 1) >> 1; + if (radius > 0) { SmoothParams p; memset(&p, 0, sizeof(p)); |