From: Torge Matthies Subject: [PATCH 2/2] windowscodecs: Disable libpng chunk size limit. Message-Id: <20211202204426.68204-2-openglfreak@googlemail.com> Date: Thu, 2 Dec 2021 21:44:26 +0100 In-Reply-To: <20211202204426.68204-1-openglfreak@googlemail.com> References: <20211202204426.68204-1-openglfreak@googlemail.com> 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 --- 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 79d8a6fbe7f..8545b9d3359 100644 --- a/dlls/windowscodecs/tests/pngformat.c +++ b/dlls/windowscodecs/tests/pngformat.c @@ -937,7 +937,7 @@ static void test_chunk_size(void) IWICBitmapDecoder *decoder; 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; } -- 2.34.1