mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-08-17 01:10:28 +03:00
LibGfx/WebPLoader: Survive calling loop_count() before other accessors
Fixes `animation` asserting when reading a webp input. (The other order of operations is still covered by TestImageWriter.cpp.)
This commit is contained in:
parent
de883d6621
commit
857750dfed
Notes:
sideshowbarker
2024-07-17 14:33:07 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/857750dfed Pull-request: https://github.com/SerenityOS/serenity/pull/24534 Reviewed-by: https://github.com/ADKaster ✅
@ -1381,9 +1381,9 @@ TEST_CASE(test_webp_extended_lossless_animated)
|
||||
EXPECT(Gfx::WebPImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::WebPImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
EXPECT_EQ(plugin_decoder->loop_count(), 42u);
|
||||
EXPECT_EQ(plugin_decoder->frame_count(), 8u);
|
||||
EXPECT(plugin_decoder->is_animated());
|
||||
EXPECT_EQ(plugin_decoder->loop_count(), 42u);
|
||||
|
||||
EXPECT_EQ(plugin_decoder->size(), Gfx::IntSize(990, 1050));
|
||||
|
||||
|
@ -639,6 +639,11 @@ size_t WebPImageDecoderPlugin::loop_count()
|
||||
if (!is_animated())
|
||||
return 0;
|
||||
|
||||
if (m_context->state < WebPLoadingContext::State::ChunksDecoded) {
|
||||
if (set_error(decode_webp_chunks(*m_context)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (m_context->state < WebPLoadingContext::State::AnimationFrameChunksDecoded) {
|
||||
if (set_error(decode_webp_animation_frame_chunks(*m_context)))
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user