Viktor Semykin : windowscodecs: Fixed loading png from streams.
Alexandre Julliard
julliard at winehq.org
Thu Jul 20 12:11:31 CDT 2017
Module: wine
Branch: stable
Commit: 48ae0addbf9aaecbdf846cfe0c8171a5a0779dcb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=48ae0addbf9aaecbdf846cfe0c8171a5a0779dcb
Author: Viktor Semykin <thesame.ml at gmail.com>
Date: Thu Mar 30 13:52:13 2017 -0300
windowscodecs: Fixed loading png from streams.
Png decoder was making one extra seek after it met IEND chunk. This led to
crashes of some software.
Signed-off-by: Viktor Semykin <thesame.ml at gmail.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 2d5c861f750eea985a45c726f31576d941e824e4)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/windowscodecs/pngformat.c | 7 +++----
dlls/windowscodecs/tests/pngformat.c | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index 9a84162..2e3a42b 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -774,11 +774,12 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p
/* Find the metadata chunks in the file. */
seek.QuadPart = 8;
- hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, &chunk_start);
- if (FAILED(hr)) goto end;
do
{
+ hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, &chunk_start);
+ if (FAILED(hr)) goto end;
+
hr = read_png_chunk(pIStream, chunk_type, NULL, &chunk_size);
if (FAILED(hr)) goto end;
@@ -816,8 +817,6 @@ static HRESULT WINAPI PngDecoder_Initialize(IWICBitmapDecoder *iface, IStream *p
}
seek.QuadPart = chunk_start.QuadPart + chunk_size + 12; /* skip data and CRC */
- hr = IStream_Seek(pIStream, seek, STREAM_SEEK_SET, &chunk_start);
- if (FAILED(hr)) goto end;
} while (memcmp(chunk_type, "IEND", 4));
This->stream = pIStream;
diff --git a/dlls/windowscodecs/tests/pngformat.c b/dlls/windowscodecs/tests/pngformat.c
index e9a0c18..02e0b1c 100644
--- a/dlls/windowscodecs/tests/pngformat.c
+++ b/dlls/windowscodecs/tests/pngformat.c
@@ -306,7 +306,7 @@ static IWICBitmapDecoder *create_decoder(const void *image_data, UINT image_size
zero.QuadPart = 0;
IStream_Seek (stream, zero, STREAM_SEEK_CUR, &pos);
- todo_wine ok(pos.QuadPart < image_size, "seek beyond the end of stream: %x%08x >= %x\n",
+ ok(pos.QuadPart < image_size, "seek beyond the end of stream: %x%08x >= %x\n",
(UINT)(pos.QuadPart >> 32), (UINT)pos.QuadPart, image_size);
refcount = IStream_Release(stream);
More information about the wine-cvs
mailing list