From 323cacc593a3c8529497676b2eef8d49a0351b74 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 11 Mar 2024 09:26:53 -0400 Subject: [PATCH] LibGfx/JBIG2: Implement decode_end_of_page() --- Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp b/Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp index 3a314ac5a5..342037079c 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp @@ -546,9 +546,14 @@ static ErrorOr decode_page_information(JBIG2LoadingContext& context, Segme return {}; } -static ErrorOr decode_end_of_page(JBIG2LoadingContext&, SegmentData const&) +static ErrorOr decode_end_of_page(JBIG2LoadingContext&, SegmentData const& segment) { - return Error::from_string_literal("JBIG2ImageDecoderPlugin: Cannot decode end of page yet"); + // 7.4.9 End of page segment syntax + if (segment.data.size() != 0) + return Error::from_string_literal("JBIG2ImageDecoderPlugin: End of page segment has non-zero size"); + // FIXME: If the page had unknown height, check that previous segment was end-of-stripe. + // FIXME: Maybe mark page as completed and error if we see more segments for it? + return {}; } static ErrorOr decode_end_of_stripe(JBIG2LoadingContext&, SegmentData const&)