Nikolay Sivov : dxva2: Limit allowed number of substreams in CreateVideoProcessor().

Alexandre Julliard julliard at winehq.org
Tue Nov 2 17:27:46 CDT 2021


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Nov  2 22:05:39 2021 +0300

dxva2: Limit allowed number of substreams in CreateVideoProcessor().

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

---

 dlls/dxva2/main.c        | 6 ++++++
 dlls/dxva2/tests/dxva2.c | 2 --
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/dlls/dxva2/main.c b/dlls/dxva2/main.c
index 81c32692f7f..46f5a7af485 100644
--- a/dlls/dxva2/main.c
+++ b/dlls/dxva2/main.c
@@ -496,6 +496,12 @@ static HRESULT WINAPI device_manager_processor_service_CreateVideoProcessor(IDir
 
     /* FIXME: validate render target format */
 
+    if (max_substreams >= 16)
+    {
+        WARN("Invalid substreams count %u.\n", max_substreams);
+        return E_INVALIDARG;
+    }
+
     if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
diff --git a/dlls/dxva2/tests/dxva2.c b/dlls/dxva2/tests/dxva2.c
index 75c23dfdcda..e3307032ad4 100644
--- a/dlls/dxva2/tests/dxva2.c
+++ b/dlls/dxva2/tests/dxva2.c
@@ -470,9 +470,7 @@ static void test_video_processor(void)
     /* Number of substreams does not include reference stream. */
     hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc,
             D3DFMT_A8R8G8B8, 16, &processor);
-todo_wine
     ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
-    if (SUCCEEDED(hr)) IDirectXVideoProcessor_Release(processor);
 
     hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &DXVA2_VideoProcSoftwareDevice, &video_desc,
             D3DFMT_A8R8G8B8, 15, &processor);




More information about the wine-cvs mailing list