mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
LibGfx/JPEG: Keep the original CMYK data in memory
When decoding a CMYK image and asked for a normal `frame()`, the decoder would convert the CMYK bitmap into an RGB bitmap. Calling `cmyk_frame()` after that point will provoke a null-dereference.
This commit is contained in:
parent
980b61470c
commit
0462858247
Notes:
sideshowbarker
2024-07-17 04:34:25 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/0462858247 Pull-request: https://github.com/SerenityOS/serenity/pull/22856 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/nico ✅
1 changed files with 1 additions and 2 deletions
|
@ -1709,7 +1709,6 @@ static ErrorOr<void> cmyk_to_rgb(JPEGLoadingContext& context)
|
|||
}
|
||||
}
|
||||
|
||||
context.cmyk_bitmap = nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -2026,7 +2025,7 @@ ErrorOr<ImageFrameDescriptor> JPEGImageDecoderPlugin::frame(size_t index, Option
|
|||
m_context->state = JPEGLoadingContext::State::BitmapDecoded;
|
||||
}
|
||||
|
||||
if (m_context->cmyk_bitmap)
|
||||
if (m_context->cmyk_bitmap && !m_context->bitmap)
|
||||
TRY(cmyk_to_rgb(*m_context));
|
||||
|
||||
return ImageFrameDescriptor { m_context->bitmap, 0 };
|
||||
|
|
Loading…
Reference in a new issue