[1/2] oleaut32: check pointer in IPicture::get_Handle
Nikolay Sivov
bunglehead at gmail.com
Wed Jan 7 00:37:28 CST 2009
Changelog:
- check pointer for NULL in IPicture::get_Handle with test
>From da35e936c8dab7805826e030b4cf9e0248df005f Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed, 7 Jan 2009 09:07:06 +0300
Subject: 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();
}
--
1.5.6.5
More information about the wine-patches
mailing list