From 698605444bca42d2e7a1841aa82580b9b488b0de Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 25 Feb 2023 15:15:55 -0500 Subject: [PATCH] LibGfx: Remove restrictive checks These checks are only valid for mono-scan SOF0 images, with tables defined before the start of frame segment. --- Userland/Libraries/LibGfx/JPEGLoader.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/Userland/Libraries/LibGfx/JPEGLoader.cpp b/Userland/Libraries/LibGfx/JPEGLoader.cpp index a9088ac2ff..adb41b0d70 100644 --- a/Userland/Libraries/LibGfx/JPEGLoader.cpp +++ b/Userland/Libraries/LibGfx/JPEGLoader.cpp @@ -553,11 +553,7 @@ static ErrorOr read_start_of_scan(AK::SeekableStream& stream, JPEGLoadingC u16 bytes_to_read = TRY(stream.read_value>()) - 2; TRY(ensure_bounds_okay(TRY(stream.tell()), bytes_to_read, context.data_size)); - u8 component_count = TRY(stream.read_value()); - if (component_count != context.components.size()) { - dbgln_if(JPEG_DEBUG, "{}: Unsupported number of components: {}!", TRY(stream.tell()), component_count); - return Error::from_string_literal("Unsupported number of components"); - } + [[maybe_unused]] u8 const component_count = TRY(stream.read_value()); Scan current_scan; @@ -573,21 +569,6 @@ static ErrorOr read_start_of_scan(AK::SeekableStream& stream, JPEGLoadingC ScanComponent scan_component { component, static_cast(table_ids >> 4), static_cast(table_ids & 0x0F) }; - if (context.dc_tables.size() != context.ac_tables.size()) { - dbgln_if(JPEG_DEBUG, "{}: DC & AC table count mismatch!", TRY(stream.tell())); - return Error::from_string_literal("DC & AC table count mismatch"); - } - - if (!context.dc_tables.contains(scan_component.dc_destination_id)) { - dbgln_if(JPEG_DEBUG, "DC table (id: {}) does not exist!", scan_component.dc_destination_id); - return Error::from_string_literal("DC table does not exist"); - } - - if (!context.ac_tables.contains(scan_component.ac_destination_id)) { - dbgln_if(JPEG_DEBUG, "AC table (id: {}) does not exist!", scan_component.ac_destination_id); - return Error::from_string_literal("AC table does not exist"); - } - current_scan.components.append(scan_component); }