mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibGfx/TIFF: Don't crash on RGBPalette images without a ColorMap
This commit is contained in:
parent
25c3f8cd8e
commit
4d1c99e414
Notes:
sideshowbarker
2024-07-17 06:20:50 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/4d1c99e414 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 9 additions and 0 deletions
|
@ -43,6 +43,14 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> ensure_conditional_tags_are_present() const
|
||||
{
|
||||
if (m_metadata.photometric_interpretation() == PhotometricInterpretation::RGBPalette && !m_metadata.color_map().has_value())
|
||||
return Error::from_string_literal("TIFFImageDecoderPlugin: RGBPalette image doesn't contain a color map");
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<void> ensure_baseline_tags_are_correct() const
|
||||
{
|
||||
if (m_metadata.strip_offsets()->size() != m_metadata.strip_byte_counts()->size())
|
||||
|
@ -58,6 +66,7 @@ public:
|
|||
{
|
||||
TRY(ensure_baseline_tags_are_present(m_metadata));
|
||||
TRY(ensure_baseline_tags_are_correct());
|
||||
TRY(ensure_conditional_tags_are_present());
|
||||
auto maybe_error = decode_frame_impl();
|
||||
|
||||
if (maybe_error.is_error()) {
|
||||
|
|
Loading…
Reference in a new issue