From: Fabian Maurer dark.shadow4@web.de
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57457 --- dlls/oleaut32/olefont.c | 2 ++ dlls/oleaut32/tests/olefont.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+)
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c index aea8b596498..bbb732f10de 100644 --- a/dlls/oleaut32/olefont.c +++ b/dlls/oleaut32/olefont.c @@ -337,6 +337,8 @@ HRESULT WINAPI OleCreateFontIndirect( fd.fStrikethrough = FALSE; lpFontDesc = &fd; } + else if (!lpFontDesc->lpstrName) + return CTL_E_INVALIDPROPERTYVALUE;
newFont = OLEFontImpl_Construct(lpFontDesc); if (!newFont) return E_OUTOFMEMORY; diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c index a8736cd0172..85b5ac99fad 100644 --- a/dlls/oleaut32/tests/olefont.c +++ b/dlls/oleaut32/tests/olefont.c @@ -1224,6 +1224,7 @@ static void test_OleCreateFontIndirect(void) IUnknown *unk, *unk2; IFont *font; HRESULT hr; + WCHAR str_empty[] = {0};
fontdesc.cbSizeofstruct = sizeof(fontdesc); fontdesc.lpstrName = arial_font; @@ -1254,6 +1255,22 @@ static void test_OleCreateFontIndirect(void) EXPECT_HR(hr, S_OK); IFont_Release(font);
+ /* Test NULL name */ + fontdesc.cbSizeofstruct = sizeof(fontdesc); + fontdesc.lpstrName = NULL; + font = (IFont*)0xdeadbeef; + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); + EXPECT_HR(hr, CTL_E_INVALIDPROPERTYVALUE); + ok(font == 0, "Got %p\n", font); + + /* Test empty Name */ + fontdesc.lpstrName = str_empty; + font = NULL; + hr = pOleCreateFontIndirect(&fontdesc, &IID_IFont, (void**)&font); + EXPECT_HR(hr, S_OK); + ok(font != 0, "Got NULL font\n"); + IFont_Release(font); + hr = OleInitialize(NULL); ok(hr == S_OK, "got 0x%08lx\n", hr);