[2/2] oleaut32: Fix loading of an empty picture from a non-statable stream.

Dmitry Timoshkov dmitry at baikal.ru
Thu Apr 10 03:03:17 CDT 2014


---
 dlls/oleaut32/olepicture.c       | 7 ++++++-
 dlls/oleaut32/tests/olepicture.c | 2 --
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 6e4a737..599042c 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -1390,12 +1390,17 @@ static HRESULT WINAPI OLEPictureImpl_Load(IPersistStream* iface, IStream *pStm)
       }
       headerread += xread;
       xread = 0;
-      
+
       if (!memcmp(&(header[0]),"lt\0\0", 4) && (statfailed || (header[1] + headerread <= statstg.cbSize.QuadPart))) {
           if (toread != 0 && toread != header[1]) 
               FIXME("varying lengths of image data (prev=%u curr=%u), only last one will be used\n",
                   toread, header[1]);
           toread = header[1];
+          if (statfailed)
+          {
+              statstg.cbSize.QuadPart = header[1] + 8;
+              statfailed = FALSE;
+          }
           if (toread == 0) break;
       } else {
           if (!memcmp(&(header[0]), "GIF8",     4) ||   /* GIF header */
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index 6861603..46dd05f 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -1226,9 +1226,7 @@ static void test_load_save_empty_picture(void)
 
     pic = NULL;
     hr = pOleLoadPicture(stream, 0, FALSE, &IID_IPicture, (void **)&pic);
-todo_wine
     ok(hr == S_OK, "OleLoadPicture error %#x\n", hr);
-todo_wine
     ok(pic != NULL,"picture should not be not NULL\n");
     if (pic != NULL)
     {
-- 
1.9.2




More information about the wine-patches mailing list