windowscodecs: Don't fail to decode GIF if an image has been already loaded.

This commit is contained in:
Dmitry Timoshkov 2015-07-13 17:09:40 +08:00 committed by Alexandre Julliard
parent 51a3bc2d9d
commit d1fde625a3
2 changed files with 7 additions and 11 deletions

View File

@ -459,43 +459,34 @@ static void test_truncated_gif(void)
stream = create_stream(gif_with_trailer_2, sizeof(gif_with_trailer_2));
if (!stream) return;
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
todo_wine
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
if (hr != S_OK) goto skip_1;
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IWICBitmapDecoder_Release(decoder);
skip_1:
IStream_Release(stream);
stream = create_stream(gif_without_trailer_1, sizeof(gif_without_trailer_1));
if (!stream) return;
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
todo_wine
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
if (hr != S_OK) goto skip_2;
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IWICBitmapDecoder_Release(decoder);
skip_2:
IStream_Release(stream);
stream = create_stream(gif_without_trailer_2, sizeof(gif_without_trailer_2));
if (!stream) return;
hr = IWICImagingFactory_CreateDecoderFromStream(factory, stream, NULL, 0, &decoder);
todo_wine
ok(hr == S_OK, "CreateDecoderFromStream error %#x\n", hr);
if (hr != S_OK) goto skip_3;
hr = IWICBitmapDecoder_GetContainerFormat(decoder, &format);
ok(hr == S_OK, "GetContainerFormat error %#x\n", hr);
ok(IsEqualGUID(&format, &GUID_ContainerFormatGif),
"wrong container format %s\n", wine_dbgstr_guid(&format));
IWICBitmapDecoder_Release(decoder);
skip_3:
IStream_Release(stream);
}

View File

@ -53,8 +53,10 @@
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "ungif.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
static void *ungif_alloc( size_t sz )
{
@ -491,7 +493,10 @@ DGifGetLine(GifFileType * GifFile,
* image until empty block (size 0) detected. We use GetCodeNext. */
do
if (DGifGetCodeNext(GifFile, &Dummy) == GIF_ERROR)
return GIF_ERROR;
{
WARN("GIF is not properly terminated\n");
break;
}
while (Dummy != NULL) ;
}
return GIF_OK;