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>
This commit is contained in:
Torge Matthies 2021-12-03 21:26:16 +01:00 committed by Alexandre Julliard
parent 2abf0173e5
commit e1130d240e
2 changed files with 2 additions and 1 deletions

View File

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

View File

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