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.
This commit is contained in:
Tete17 2025-05-16 00:10:50 +02:00 committed by Tim Flynn
commit 81bfb51756
Notes: github-actions[bot] 2025-06-14 22:28:05 +00:00

View file

@ -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");