From 0a827eaa028e648fb9e42fd02564ab1647a4e190 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Thu, 23 Dec 2021 01:49:27 -0800 Subject: [PATCH] LibGfx: Fix incorrect error handling in ICOLoader This was found by OSS Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=42188 --- Userland/Libraries/LibGfx/ICOLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/ICOLoader.cpp b/Userland/Libraries/LibGfx/ICOLoader.cpp index 1ff99ad6c4..3c4edf850d 100644 --- a/Userland/Libraries/LibGfx/ICOLoader.cpp +++ b/Userland/Libraries/LibGfx/ICOLoader.cpp @@ -264,7 +264,7 @@ static bool load_ico_bitmap(ICOLoadingContext& context, Optional index) PNGImageDecoderPlugin png_decoder(context.data + desc.offset, desc.size); if (png_decoder.sniff()) { auto decoded_png_frame = png_decoder.frame(0); - if (!decoded_png_frame.is_error() || !decoded_png_frame.value().image) { + if (decoded_png_frame.is_error() || !decoded_png_frame.value().image) { dbgln_if(ICO_DEBUG, "load_ico_bitmap: failed to load PNG encoded image index: {}", real_index); return false; }