X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Ferror_resilience.c;h=1abae53f41d41e4d3aa5e19f33570190bec87375;hb=7f22a4ebc97817fd0968f5ea8295c9a59a6292e0;hp=55f77961c51ea5589bc2009b74396cd800f8b8a1;hpb=40e32f83c6a2085093b61e959f34a106fa2dad6b;p=ffmpeg diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c index 55f77961c51..1abae53f41d 100644 --- a/libavcodec/error_resilience.c +++ b/libavcodec/error_resilience.c @@ -107,7 +107,7 @@ static void filter181(int16_t *data, int width, int height, ptrdiff_t stride) dc = -prev_dc + data[x + y * stride] * 8 - data[x + 1 + y * stride]; - dc = (dc * 10923 + 32768) >> 16; + dc = (av_clip(dc, INT_MIN/10923, INT_MAX/10923 - 32768) * 10923 + 32768) >> 16; prev_dc = data[x + y * stride]; data[x + y * stride] = dc; } @@ -123,7 +123,7 @@ static void filter181(int16_t *data, int width, int height, ptrdiff_t stride) dc = -prev_dc + data[x + y * stride] * 8 - data[x + (y + 1) * stride]; - dc = (dc * 10923 + 32768) >> 16; + dc = (av_clip(dc, INT_MIN/10923, INT_MAX/10923 - 32768) * 10923 + 32768) >> 16; prev_dc = data[x + y * stride]; data[x + y * stride] = dc; }