From 18064fdb928bfd121ac6f5b9608c2bb1582bdfb7 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Mon, 27 Feb 2023 22:54:27 -0500 Subject: [PATCH] LibGfx/JPEG: Don't call `add_ac` if not necessary Calling it was harmless as add_ac iterates over the spectral selection, hence it won't do anything if not needed. However, this patch remains useful as it prevents dereferencing the iterator returned by find, in case the AC table isn't defined yet. This case happens with SOF2 images and is (pretty harmless as read only but still) undefined behavior. --- Userland/Libraries/LibGfx/JPEGLoader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/JPEGLoader.cpp b/Userland/Libraries/LibGfx/JPEGLoader.cpp index fe746b2344..ae5e7e3b83 100644 --- a/Userland/Libraries/LibGfx/JPEGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPEGLoader.cpp @@ -443,7 +443,8 @@ static ErrorOr build_macroblocks(JPEGLoadingContext& context, Vector