Commit 852c61c5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

dxgi: Properly check if the output array is large enough in dxgi_output_GetDisplayModeList().

parent d9570c39
......@@ -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)
{
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment