dxgi: Properly check if the output array is large enough in dxgi_output_GetDisplayModeList().
This commit is contained in:
parent
d9570c3935
commit
852c61c595
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue