[PATCH] oleaut32: Don't crash on NULL string arguments
Andrew Eikum
aeikum at codeweavers.com
Tue Sep 10 08:45:41 CDT 2013
---
dlls/oleaut32/tests/typelib.c | 11 +++++++++++
dlls/oleaut32/typelib.c | 3 +++
2 files changed, 14 insertions(+)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 1c398f9..17a3b99 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -4243,6 +4243,8 @@ static void test_SetFuncAndParamNames(void)
static OLECHAR nameW[] = {'n','a','m','e',0};
static OLECHAR prop[] = {'p','r','o','p',0};
static OLECHAR *propW[] = {prop};
+ static OLECHAR func[] = {'f','u','n','c',0};
+ static OLECHAR *funcW[] = {func, NULL};
CHAR filenameA[MAX_PATH];
WCHAR filenameW[MAX_PATH];
ICreateTypeLib2 *ctl;
@@ -4309,6 +4311,15 @@ static void test_SetFuncAndParamNames(void)
hr = ICreateTypeInfo_SetFuncAndParamNames(cti, 3, propW, 1);
ok(hr == TYPE_E_AMBIGUOUSNAME, "got 0x%08x\n", hr);
+ /* regular function */
+ funcdesc.invkind = INVOKE_FUNC;
+ funcdesc.cParams = 1;
+ hr = ICreateTypeInfo_AddFuncDesc(cti, 4, &funcdesc);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = ICreateTypeInfo_SetFuncAndParamNames(cti, 4, funcW, 2);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
ICreateTypeInfo_Release(cti);
ICreateTypeLib2_Release(ctl);
DeleteFileA(filenameA);
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 328e28a..afcdc5c 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -1889,6 +1889,9 @@ static TLBString *TLB_append_str(struct list *string_list, BSTR new_str)
{
TLBString *str;
+ if(!new_str)
+ return NULL;
+
LIST_FOR_EACH_ENTRY(str, string_list, TLBString, entry) {
if (strcmpW(str->str, new_str) == 0)
return str;
--
1.8.4
More information about the wine-patches
mailing list