mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
LibGfx/TIFF: Use a wider type for palette indices to prevent overflow
We refuse any image with a sample depth greater than 32, storing these value as `u64` prevent any overflows. This is probably overkill as no one in their right mind will use a 32 bits color table.
This commit is contained in:
parent
4d1c99e414
commit
58bdca96cd
Notes:
sideshowbarker
2024-07-17 07:38:17 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/58bdca96cd Pull-request: https://github.com/SerenityOS/serenity/pull/22674 Reviewed-by: https://github.com/Hendiadyoin1 Reviewed-by: https://github.com/nico ✅
1 changed files with 4 additions and 4 deletions
|
@ -182,10 +182,10 @@ private:
|
|||
// From description of PhotometricInterpretation in Section 8: Baseline Field Reference Guide
|
||||
// "In a TIFF ColorMap, all the Red values come first, followed by the Green values,
|
||||
// then the Blue values."
|
||||
auto const size = 1 << (*m_metadata.bits_per_sample())[0];
|
||||
auto const red_offset = 0 * size;
|
||||
auto const green_offset = 1 * size;
|
||||
auto const blue_offset = 2 * size;
|
||||
u64 const size = 1ul << (*m_metadata.bits_per_sample())[0];
|
||||
u64 const red_offset = 0 * size;
|
||||
u64 const green_offset = 1 * size;
|
||||
u64 const blue_offset = 2 * size;
|
||||
|
||||
auto const color_map = *m_metadata.color_map();
|
||||
|
||||
|
|
Loading…
Reference in a new issue