Module: wine Branch: master Commit: e1130d240e8a3ff05c814dd8a2d6e55b3f054e5c URL: https://source.winehq.org/git/wine.git/?a=commit;h=e1130d240e8a3ff05c814dd8a...
Author: Torge Matthies openglfreak@googlemail.com Date: Fri Dec 3 21:26:16 2021 +0100
windowscodecs: Disable libpng chunk size limit.
Reading a PNG file with libpng with a chunk bigger than the 8 MiB default chunk size limit set by libpng results in a libpng error, e.g. "iTXt: chunk data is too large" for a too big iTXt chunk.
Fix this by disabling the chunk size limit.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52147 Signed-off-by: Torge Matthies openglfreak@googlemail.com Signed-off-by: Esme Povirk esme@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/windowscodecs/libpng.c | 1 + dlls/windowscodecs/tests/pngformat.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/windowscodecs/libpng.c b/dlls/windowscodecs/libpng.c index 27a735550f3..8e876b23efe 100644 --- a/dlls/windowscodecs/libpng.c +++ b/dlls/windowscodecs/libpng.c @@ -107,6 +107,7 @@ static HRESULT CDECL png_decoder_initialize(struct decoder *iface, IStream *stre goto end; } png_set_crc_action(png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE); + png_set_chunk_malloc_max(png_ptr, 0);
/* seek to the start of the stream */ hr = stream_seek(stream, 0, STREAM_SEEK_SET, NULL); diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c index b44fd017fcf..32afc989c2b 100644 --- a/dlls/windowscodecs/tests/pngformat.c +++ b/dlls/windowscodecs/tests/pngformat.c @@ -944,7 +944,7 @@ static void test_chunk_size(void) memcpy(png_8M_tEXt + sizeof(png_8M_tEXt) - sizeof(png_8M_tEXt_end), png_8M_tEXt_end, sizeof(png_8M_tEXt_end));
hr = create_decoder(png_8M_tEXt, sizeof(png_8M_tEXt), &decoder); - todo_wine ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr); + ok(hr == S_OK, "Failed to load PNG image data %#x\n", hr); if (hr != S_OK) return;
IWICBitmapDecoder_Release(decoder);