Module: wine Branch: master Commit: 852c61c5959e4d92dc9a45166cb4b3a78df678d6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=852c61c5959e4d92dc9a45166c...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Mon Feb 10 10:37:57 2014 +0100
dxgi: Properly check if the output array is large enough in dxgi_output_GetDisplayModeList().
---
dlls/dxgi/output.c | 9 ++++++++- dlls/dxgi/tests/device.c | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/dxgi/output.c b/dlls/dxgi/output.c index ec9d01b..580a8b4 100644 --- a/dlls/dxgi/output.c +++ b/dlls/dxgi/output.c @@ -155,7 +155,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa return S_OK; }
- *mode_count = min(*mode_count,max_count); + if (max_count > *mode_count) + { + wined3d_decref(wined3d); + LeaveCriticalSection(&dxgi_cs); + return DXGI_ERROR_MORE_DATA; + } + + *mode_count = max_count;
for (i = 0; i < *mode_count; ++i) { diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index d648dc7..f44e831 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -315,7 +315,7 @@ static void test_output(void) mode_count = 0; hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_SCALING, &mode_count, modes); - todo_wine ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr); + ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr); ok(!modes[0].Height, "No output was expected.\n");
mode_count = mode_count_comp; @@ -340,7 +340,7 @@ static void test_output(void) mode_count = mode_count_comp - 1; hr = IDXGIOutput_GetDisplayModeList(output, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_SCALING, &mode_count, modes); - todo_wine ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr); + ok(hr == DXGI_ERROR_MORE_DATA, "Got unexpected hr %#x.\n", hr); ok(mode_count == mode_count_comp - 1, "Got unexpected mode_count %u, expected %u.\n", mode_count, mode_count_comp - 1); }