Nikolay Sivov : mfplat: Allow NULL size pointer in IMFAttributes::GetAllocatedBlob().

Alexandre Julliard julliard at winehq.org
Thu May 12 15:55:50 CDT 2022


Module: wine
Branch: master
Commit: e3f226fde01d96c5e7799884ed4da5324adceca9
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e3f226fde01d96c5e7799884ed4da5324adceca9

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu May 12 09:13:29 2022 +0300

mfplat: Allow NULL size pointer in IMFAttributes::GetAllocatedBlob().

Signed-off-by: Nikolay Sivov <nsivov 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 08195bca448..24d39d81b62 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -2743,7 +2743,8 @@ HRESULT attributes_GetAllocatedBlob(struct attributes *attributes, REFGUID key,
     if (SUCCEEDED(hr))
     {
         *buf = attrval.caub.pElems;
-        *size = attrval.caub.cElems;
+        if (size)
+            *size = attrval.caub.cElems;
     }
 
     return hr;
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 8f18fcb293d..3f7ab161b59 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -1749,6 +1749,11 @@ static void test_attributes(void)
     ok(!memcmp(blob_buf, blob, size), "Unexpected blob.\n");
     CoTaskMemFree(blob_buf);
 
+    hr = IMFAttributes_GetAllocatedBlob(attributes, &DUMMY_GUID1, &blob_buf, NULL);
+    ok(hr == S_OK, "Failed to get allocated blob, hr %#lx.\n", hr);
+    ok(!memcmp(blob_buf, blob, size), "Unexpected blob.\n");
+    CoTaskMemFree(blob_buf);
+
     hr = IMFAttributes_GetAllocatedBlob(attributes, &DUMMY_GUID2, &blob_buf, &size);
     ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
 




More information about the wine-cvs mailing list