From 81bfb51756551368855c313438d3935492b151fd Mon Sep 17 00:00:00 2001 From: Tete17 Date: Fri, 16 May 2025 00:10:50 +0200 Subject: [PATCH] LibCompress: Handle the error state where a dictionary is needed For zlib is not necessarily an error state but the web standards do not support this feature and the WPT tests explicitly check for this case to be handled as an error. --- Libraries/LibCompress/GenericZlib.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Libraries/LibCompress/GenericZlib.cpp b/Libraries/LibCompress/GenericZlib.cpp index 1ab1d992225..6a49950b894 100644 --- a/Libraries/LibCompress/GenericZlib.cpp +++ b/Libraries/LibCompress/GenericZlib.cpp @@ -15,6 +15,9 @@ static Error handle_zlib_error(int ret) switch (ret) { case Z_ERRNO: return Error::from_errno(errno); + case Z_NEED_DICT: + // Z_NEED_DICT if the input data needed a dictionary + return Error::from_string_literal("zlib data needs dictionary"); case Z_DATA_ERROR: // Z_DATA_ERROR if the input data was corrupted return Error::from_string_literal("zlib data error");