Nikolay Sivov : evr/presenter: Validate passed handle on SetVideoWindow().

Alexandre Julliard julliard at winehq.org
Tue Oct 6 15:33:11 CDT 2020


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Oct  6 14:48:59 2020 +0300

evr/presenter: Validate passed handle on SetVideoWindow().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 9acbead728..15ebcd80ac 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 53f1b02724..79020e1ec4 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);
 




More information about the wine-cvs mailing list