André Hentschel : oleaut32: Fix a crash in VB6.
Alexandre Julliard
julliard at winehq.org
Mon Jan 25 11:21:17 CST 2010
Module: wine
Branch: master
Commit: 571b7a5a3a1c0c6e334f880deaa01a7c68ea0aaf
URL: http://source.winehq.org/git/wine.git/?a=commit;h=571b7a5a3a1c0c6e334f880deaa01a7c68ea0aaf
Author: André Hentschel <nerv at dawncrow.de>
Date: Sun Jan 24 20:14:48 2010 +0100
oleaut32: Fix a crash in VB6.
---
dlls/oleaut32/olefont.c | 3 +++
dlls/oleaut32/tests/olefont.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index a9b2c04..2fc842c 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -463,6 +463,9 @@ static HRESULT WINAPI OLEFontImpl_put_Name(
OLEFontImpl *this = (OLEFontImpl *)iface;
TRACE("(%p)->(%p)\n", this, name);
+ if (!name)
+ return CTL_E_INVALIDPROPERTYVALUE;
+
if (this->description.lpstrName==0)
{
this->description.lpstrName = HeapAlloc(GetProcessHeap(),
diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c
index 55e0e58..fd26388 100644
--- a/dlls/oleaut32/tests/olefont.c
+++ b/dlls/oleaut32/tests/olefont.c
@@ -795,6 +795,45 @@ static void test_AddRefHfont(void)
IFont_Release(ifnt3);
}
+static void test_returns(void)
+{
+ IFont *pFont;
+ FONTDESC fontdesc;
+ HRESULT hr;
+
+ fontdesc.cbSizeofstruct = sizeof(fontdesc);
+ fontdesc.lpstrName = MSSansSerif_font;
+ fontdesc.cySize.int64 = 12 * 10000; /* 12 pt */
+ fontdesc.sWeight = FW_NORMAL;
+ fontdesc.sCharset = 0;
+ fontdesc.fItalic = FALSE;
+ fontdesc.fUnderline = FALSE;
+ fontdesc.fStrikethrough = FALSE;
+
+ hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void **)&pFont);
+ ok_ole_success(hr, "OleCreateFontIndirect");
+
+ hr = IFont_put_Name(pFont, NULL);
+ ok(hr == CTL_E_INVALIDPROPERTYVALUE,
+ "IFont::put_Name: Expected CTL_E_INVALIDPROPERTYVALUE got 0x%08x\n",
+ hr);
+
+ hr = IFont_get_Name(pFont, NULL);
+ ok(hr == E_POINTER,
+ "IFont::get_Name: Expected E_POINTER got 0x%08x\n",
+ hr);
+
+ hr = IFont_get_Size(pFont, NULL);
+ ok(hr == E_POINTER,
+ "IFont::get_Size: Expected E_POINTER got 0x%08x\n",
+ hr);
+
+ hr = IFont_get_Bold(pFont, NULL);
+ ok(hr == E_POINTER,
+ "IFont::get_Bold: Expected E_POINTER got 0x%08x\n",
+ hr);
+}
+
START_TEST(olefont)
{
hOleaut32 = GetModuleHandleA("oleaut32.dll");
@@ -827,4 +866,5 @@ START_TEST(olefont)
test_IsEqual();
test_ReleaseHfont();
test_AddRefHfont();
+ test_returns();
}
More information about the wine-cvs
mailing list