X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fvideodsp_template.c;h=55123a5844689607c95aed73d9c0b4ee5633d925;hb=9e13df3776da3a101e895e2840f6f23f5a6f74a0;hp=94c1b7188d23c16eea222106d54455ff7bb775cd;hpb=73d193d1d0ff62a029a905d1404c0fd357f4c880;p=ffmpeg diff --git a/libavcodec/videodsp_template.c b/libavcodec/videodsp_template.c index 94c1b7188d2..55123a58446 100644 --- a/libavcodec/videodsp_template.c +++ b/libavcodec/videodsp_template.c @@ -44,7 +44,8 @@ void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, src_y = 1 - block_h; } if (src_x >= w) { - src += (w - 1 - src_x) * sizeof(pixel); + // The subtracted expression has an unsigned type and must thus not be negative + src -= (1 + src_x - w) * sizeof(pixel); src_x = w - 1; } else if (src_x <= -block_w) { src += (1 - block_w - src_x) * sizeof(pixel);