[PATCH 3/5] evr/presenter: Validate passed handle on SetVideoWindow().

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


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

diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c
index 9acbead7287..15ebcd80acc 100644
--- a/dlls/evr/presenter.c
+++ b/dlls/evr/presenter.c
@@ -603,6 +603,9 @@ static HRESULT WINAPI video_presenter_control_SetVideoWindow(IMFVideoDisplayCont
 
     TRACE("%p, %p.\n", iface, window);
 
+    if (!IsWindow(window))
+        return E_INVALIDARG;
+
     EnterCriticalSection(&presenter->cs);
     presenter->video_window = window;
     LeaveCriticalSection(&presenter->cs);
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c
index 53f1b02724d..79020e1ec49 100644
--- a/dlls/evr/tests/evr.c
+++ b/dlls/evr/tests/evr.c
@@ -1073,6 +1073,12 @@ static void test_default_presenter(void)
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
     ok(hwnd2 == NULL, "Unexpected window %p.\n", hwnd2);
 
+    hr = IMFVideoDisplayControl_SetVideoWindow(display_control, NULL);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+
+    hr = IMFVideoDisplayControl_SetVideoWindow(display_control, (HWND)0x1);
+    ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
+
     hr = IMFVideoDisplayControl_SetVideoWindow(display_control, hwnd);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
 
-- 
2.28.0




More information about the wine-devel mailing list