From 07f72b6d4190130137a6119bd1287f307a69b3d3 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sun, 16 Jul 2023 23:47:40 -0400 Subject: [PATCH] LibGfx/PNG: Don't try to guess if IHDR has been decoded --- Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp index 9018cf5840..f1917748ad 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp @@ -630,10 +630,8 @@ static bool decode_png_ihdr(PNGLoadingContext& context) context.data_current_ptr = streamer.current_data_ptr(); - if (context.width && context.height) { - context.state = PNGLoadingContext::State::IHDRDecoded; + if (context.state == PNGLoadingContext::State::IHDRDecoded) return true; - } } return false; @@ -1018,6 +1016,9 @@ static ErrorOr process_IHDR(ReadonlyBytes data, PNGLoadingContext& context default: return Error::from_string_literal("Unsupported color type"); } + + context.state = PNGLoadingContext::IHDRDecoded; + return {}; }