mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +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
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 {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2026,7 +2025,7 @@ ErrorOr<ImageFrameDescriptor> JPEGImageDecoderPlugin::frame(size_t index, Option
|
||||||
m_context->state = JPEGLoadingContext::State::BitmapDecoded;
|
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));
|
TRY(cmyk_to_rgb(*m_context));
|
||||||
|
|
||||||
return ImageFrameDescriptor { m_context->bitmap, 0 };
|
return ImageFrameDescriptor { m_context->bitmap, 0 };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue