ffmpeg | branch: master | Michael Niedermayer <mich...@niedermayer.cc> | Thu 
May  8 15:30:57 2025 +0200| [43926e026dd80918e1387801077c58cf02b6c99d] | 
committer: Michael Niedermayer

avcodec/mmvideo: fix palette index

Fixes: 
391935573/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MMVIDEO_fuzzer-4655048979709952
Fixes: out of array access

Reviewed-by: Peter Ross <pr...@xvid.org>
Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43926e026dd80918e1387801077c58cf02b6c99d
---

 libavcodec/mmvideo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index 7313507deb..2a0c855992 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -91,7 +91,7 @@ static void mm_decode_pal(MmContext *s)
     int start = bytestream2_get_le16(&s->gb);
     int count = bytestream2_get_le16(&s->gb);
     for (int i = 0; i < count; i++)
-        s->palette[start+i] = 0xFFU << 24 | (bytestream2_get_be24(&s->gb) << 
2);
+        s->palette[(start+i)&0xFF] = 0xFFU << 24 | 
(bytestream2_get_be24(&s->gb) << 2);
 }
 
 /**

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to