From 181d93ea5afcb09c64828e93c2a5cdec8fc99929 Mon Sep 17 00:00:00 2001 From: rootvector2 Date: Thu, 28 May 2026 14:46:10 +0530 Subject: [PATCH] fix off-by-one palette bounds check in gif non-replace branch --- lib/extras/dec/gif.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/extras/dec/gif.cc b/lib/extras/dec/gif.cc index cd6d273a..59c403a0 100644 --- a/lib/extras/dec/gif.cc +++ b/lib/extras/dec/gif.cc @@ -377,7 +377,7 @@ Status DecodeImageGIF(Span bytes, const ColorHints& color_hints, y * sub_frame_image.xsize; for (size_t x = 0; x < image_rect.xsize(); ++x, ++byte_index) { const GifByteType byte = image.RasterBits[byte_index]; - if (byte > color_map->ColorCount) { + if (byte >= color_map->ColorCount) { return JPEGLI_FAILURE("GIF color is out of bounds"); } if (byte == gcb.TransparentColor) {