mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-01 15:18:06 +00:00
LibGfx/TIFF: Reject images that declare a sample with abnormal bit depth
Anything with a bit depth of zero or greater than 32 is outside our working range, so let's reject them.
This commit is contained in:
parent
ba84af7c22
commit
4e09ee1f2f
Notes:
sideshowbarker
2024-07-17 02:05:41 +09:00
Author: https://github.com/LucasChollet
Commit: 4e09ee1f2f
Pull-request: https://github.com/SerenityOS/serenity/pull/22513
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/nico ✅
1 changed files with 3 additions and 0 deletions
|
@ -47,6 +47,9 @@ public:
|
|||
if (m_metadata.strip_offsets()->size() != m_metadata.strip_byte_counts()->size())
|
||||
return Error::from_string_literal("TIFFImageDecoderPlugin: StripsOffset and StripByteCount have different sizes");
|
||||
|
||||
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 {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue