From 8d9cb538d6abc20cc34200e4835f5ac142e066f4 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sun, 26 Feb 2023 17:52:56 +0000 Subject: [PATCH] LibGfx: Don't return an error for webp sniff failures The correct thing to do here is return false, returing an error crashes the ImageDecoder. --- Userland/Libraries/LibGfx/WebPLoader.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/WebPLoader.cpp b/Userland/Libraries/LibGfx/WebPLoader.cpp index a37066869c..c1ed838fa0 100644 --- a/Userland/Libraries/LibGfx/WebPLoader.cpp +++ b/Userland/Libraries/LibGfx/WebPLoader.cpp @@ -526,8 +526,7 @@ ErrorOr WebPImageDecoderPlugin::sniff(ReadonlyBytes data) { WebPLoadingContext context; context.data = data; - TRY(decode_webp_header(context)); - return true; + return !decode_webp_header(context).is_error(); } ErrorOr> WebPImageDecoderPlugin::create(ReadonlyBytes data)