Nikolay Sivov : oleaut32: Check pointer in IPicture::get_Handle.

Alexandre Julliard julliard at winehq.org
Wed Jan 7 10:57:15 CST 2009


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

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Wed Jan  7 09:07:06 2009 +0300

oleaut32: Check pointer in IPicture::get_Handle.

---

 dlls/oleaut32/olepicture.c       |    4 ++++
 dlls/oleaut32/tests/olepicture.c |   14 ++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 3d0af78..51423a2 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -519,6 +519,10 @@ static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface,
 {
   OLEPictureImpl *This = (OLEPictureImpl *)iface;
   TRACE("(%p)->(%p)\n", This, phandle);
+
+  if(!phandle)
+    return E_POINTER;
+
   switch(This->desc.picType) {
   case PICTYPE_NONE:
   case PICTYPE_UNINITIALIZED:
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index 7bff9b0..6cf80b7 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -674,6 +674,19 @@ static void test_get_Attributes(void)
     IPicture_Release(pic);
 }
 
+static void test_get_Handle(void)
+{
+    IPicture *pic;
+    HRESULT hres;
+
+    OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (VOID**)&pic);
+
+    hres = IPicture_get_Handle(pic, NULL);
+    ole_expect(hres, E_POINTER);
+
+    IPicture_Release(pic);
+}
+
 START_TEST(olepicture)
 {
 	hOleaut32 = GetModuleHandleA("oleaut32.dll");
@@ -702,6 +715,7 @@ START_TEST(olepicture)
         test_OleCreatePictureIndirect();
         test_Render();
         test_get_Attributes();
+        test_get_Handle();
 }
 
 




More information about the wine-cvs mailing list