From c869cb2572bbca4b2f8c941abb98d33a8e73a0be Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 22 Sep 2023 19:12:09 +0200 Subject: [PATCH 2/3] avcodec/eamad: do not use unsigned for offset Signed-off-by: Paul B Mahol --- libavcodec/eamad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index 287575e073..18249cecc7 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -91,7 +91,7 @@ static inline void comp_block(MadContext *t, AVFrame *frame, int j, int mv_x, int mv_y, int add) { if (j < 4) { - unsigned offset = (mb_y*16 + ((j&2)<<2) + mv_y)*t->last_frame->linesize[0] + mb_x*16 + ((j&1)<<3) + mv_x; + ptrdiff_t offset = (mb_y*16 + ((j&2)<<2) + mv_y)*t->last_frame->linesize[0] + mb_x*16 + ((j&1)<<3) + mv_x; if (offset >= (t->avctx->height - 7) * t->last_frame->linesize[0] - 7) return; comp(frame->data[0] + (mb_y*16 + ((j&2)<<2))*frame->linesize[0] + mb_x*16 + ((j&1)<<3), @@ -100,7 +100,7 @@ static inline void comp_block(MadContext *t, AVFrame *frame, t->last_frame->linesize[0], add); } else if (!(t->avctx->flags & AV_CODEC_FLAG_GRAY)) { int index = j - 3; - unsigned offset = (mb_y * 8 + (mv_y/2))*t->last_frame->linesize[index] + mb_x * 8 + (mv_x/2); + ptrdiff_t offset = (mb_y * 8 + (mv_y/2))*t->last_frame->linesize[index] + mb_x * 8 + (mv_x/2); if (offset >= (t->avctx->height/2 - 7) * t->last_frame->linesize[index] - 7) return; comp(frame->data[index] + (mb_y*8)*frame->linesize[index] + mb_x * 8, -- 2.42.0