Module: wine Branch: master Commit: af18a098628fb60d3b296a689183c5a97e4afe1f URL: http://source.winehq.org/git/wine.git/?a=commit;h=af18a098628fb60d3b296a6891...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Wed Apr 20 10:50:59 2016 +0300
dwrite: Handle NULL path in CreateFontFileReference().
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dwrite/font.c | 3 +++ dlls/dwrite/main.c | 2 ++ dlls/dwrite/tests/font.c | 5 +++++ 3 files changed, 10 insertions(+)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index fef11e6..4d5f43c 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -4399,6 +4399,9 @@ HRESULT get_local_refkey(const WCHAR *path, const FILETIME *writetime, void **ke { struct local_refkey *refkey;
+ if (!path) + return E_INVALIDARG; + *size = FIELD_OFFSET(struct local_refkey, name) + (strlenW(path)+1)*sizeof(WCHAR); *key = NULL;
diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index 47f57d8..da12669 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -778,6 +778,8 @@ static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory3 *ifa
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(path), writetime, font_file);
+ *font_file = NULL; + if (!This->localfontfileloader) { hr = create_localfontfileloader(&This->localfontfileloader); diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index d5de80e..64e6a93 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -2599,6 +2599,11 @@ static void test_CreateFontFileReference(void) path = create_testfontfile(test_fontfile); factory = create_factory();
+ ffile = (void*)0xdeadbeef; + hr = IDWriteFactory_CreateFontFileReference(factory, NULL, NULL, &ffile); + ok(hr == E_INVALIDARG, "got 0x%08x\n",hr); + ok(ffile == NULL, "got %p\n", ffile); + hr = IDWriteFactory_CreateFontFileReference(factory, path, NULL, &ffile); ok(hr == S_OK, "got 0x%08x\n",hr);