mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
LibGfx/TIFF: Reject images with an incoherent number of BitsPerSample
Fixes oss-fuzz issue 66588: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66588
This commit is contained in:
parent
d15785cccc
commit
06665cba9c
1 changed files with 6 additions and 0 deletions
|
@ -106,6 +106,12 @@ public:
|
||||||
if (any_of(*m_metadata.bits_per_sample(), [](auto bit_depth) { return bit_depth == 0 || bit_depth > 32; }))
|
if (any_of(*m_metadata.bits_per_sample(), [](auto bit_depth) { return bit_depth == 0 || bit_depth > 32; }))
|
||||||
return Error::from_string_literal("TIFFImageDecoderPlugin: Invalid value in BitsPerSample");
|
return Error::from_string_literal("TIFFImageDecoderPlugin: Invalid value in BitsPerSample");
|
||||||
|
|
||||||
|
if (m_metadata.bits_per_sample()->size() != m_metadata.samples_per_pixel())
|
||||||
|
return Error::from_string_literal("TIFFImageDecoderPlugin: Invalid number of values in BitsPerSample");
|
||||||
|
|
||||||
|
if (*m_metadata.samples_per_pixel() < samples_for_photometric_interpretation())
|
||||||
|
return Error::from_string_literal("TIFFImageDecoderPlugin: Not enough values in BitsPerSample for given PhotometricInterpretation");
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue