[PATCH 2/5] evr/presenter: Check for null argument in GetVideoWindow().

Nikolay Sivov nsivov at codeweavers.com
Tue Oct 6 06:48:58 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/evr/presenter.c | 5 +++++
 dlls/evr/tests/evr.c | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index 8c455778d77..9acbead7287 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -616,7 +616,12 @@ static HRESULT WINAPI video_presenter_control_GetVideoWindow(IMFVideoDisplayCont
 
     TRACE("%p, %p.\n", iface, window);
 
+    if (!window)
+        return E_POINTER;
+
+    EnterCriticalSection(&presenter->cs);
     *window = presenter->video_window;
+    LeaveCriticalSection(&presenter->cs);
 
     return S_OK;
 }
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 85eedbe6643..53f1b02724d 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -1065,6 +1065,9 @@ static void test_default_presenter(void)
     hwnd = create_window();
     ok(!!hwnd, "Failed to create a test window.\n");
 
+    hr = IMFVideoDisplayControl_GetVideoWindow(display_control, NULL);
+    ok(hr == E_POINTER, "Unexpected hr %#x.\n", hr);
+
     hwnd2 = hwnd;
     hr = IMFVideoDisplayControl_GetVideoWindow(display_control, &hwnd2);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
-- 
2.28.0




More information about the wine-devel mailing list