1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

LibGfx/TIFF: Don't crash on invalid indices inside RGBPalette images

We were previously accessing a Vector's element using a user-provided
value as index input.
This commit is contained in:
Lucas CHOLLET 2024-01-09 17:43:52 -05:00 committed by Andreas Kling
parent 58bdca96cd
commit 0ef449a588

View file

@ -189,6 +189,9 @@ private:
auto const color_map = *m_metadata.color_map();
if (blue_offset + index >= color_map.size())
return Error::from_string_literal("TIFFImageDecoderPlugin: Color index is out of range");
// FIXME: ColorMap's values are always 16-bits, stop truncating them when we support 16 bits bitmaps
return Color(
color_map[red_offset + index] >> 8,