diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index 990dcf6ecfe..c98a6a7e28b 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 e9a0c188114..02e0b1c1fd0 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);