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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 14 09:42:26 CDT 2015


Module: wine
Branch: master
Commit: d1fde625a352b67b06a1ae176bcde3ca62459972
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d1fde625a352b67b06a1ae176bcde3ca62459972

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Mon Jul 13 17:09:40 2015 +0800

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

---

 dlls/windowscodecs/tests/gifformat.c | 9 ---------
 dlls/windowscodecs/ungif.c           | 9 +++++++--
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/dlls/windowscodecs/tests/gifformat.c b/dlls/windowscodecs/tests/gifformat.c
index 85ffc8f..53b4e47 100644
--- a/dlls/windowscodecs/tests/gifformat.c
+++ b/dlls/windowscodecs/tests/gifformat.c
@@ -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);
 }
 
diff --git a/dlls/windowscodecs/ungif.c b/dlls/windowscodecs/ungif.c
index 427b32f..b413ff0 100644
--- a/dlls/windowscodecs/ungif.c
+++ b/dlls/windowscodecs/ungif.c
@@ -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;




More information about the wine-cvs mailing list