Andrew Eikum : mfplat: Allow NULL length pointer in IMFAttributes::GetAllocatedString.
Alexandre Julliard
julliard at winehq.org
Wed May 11 16:10:24 CDT 2022
Module: wine
Branch: master
Commit: ca10760d2e7ea4f8718741592fd639f589247e53
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ca10760d2e7ea4f8718741592fd639f589247e53
Author: Andrew Eikum <aeikum at codeweavers.com>
Date: Mon May 9 10:56:29 2022 -0500
mfplat: Allow NULL length pointer in IMFAttributes::GetAllocatedString.
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/main.c | 3 ++-
dlls/mfplat/tests/mfplat.c | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index cee052defeb..08195bca448 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -2670,7 +2670,8 @@ HRESULT attributes_GetAllocatedString(struct attributes *attributes, REFGUID key
if (SUCCEEDED(hr))
{
*value = attrval.pwszVal;
- *length = lstrlenW(*value);
+ if (length)
+ *length = lstrlenW(*value);
}
return hr;
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 8d21f2ed60e..8f18fcb293d 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -1638,6 +1638,11 @@ static void test_attributes(void)
ok(hr == S_OK, "Failed to get string length, hr %#lx.\n", hr);
ok(string_length == lstrlenW(stringW), "Unexpected length %u.\n", string_length);
+ hr = IMFAttributes_GetAllocatedString(attributes, &DUMMY_GUID1, &string, NULL);
+ ok(hr == S_OK, "Failed to get allocated string, hr %#lx.\n", hr);
+ ok(!lstrcmpW(string, stringW), "Unexpected string %s.\n", wine_dbgstr_w(string));
+ CoTaskMemFree(string);
+
string_length = 0xdeadbeef;
hr = IMFAttributes_GetAllocatedString(attributes, &DUMMY_GUID1, &string, &string_length);
ok(hr == S_OK, "Failed to get allocated string, hr %#lx.\n", hr);
More information about the wine-cvs
mailing list