Missing a bound check for "modes".
From: Yuxuan Shui yshui@codeweavers.com
Missing a bound check for "modes". --- dlls/dxgi/tests/dxgi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index cb8bec5c666..47905bed66d 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -6912,8 +6912,10 @@ static void test_cursor_clipping(IUnknown *device, BOOL is_d3d12) if (modes[mode_idx].Width != width && modes[mode_idx].Height != height) break; } - ok(modes[mode_idx].Width != width && modes[mode_idx].Height != height, + ok(mode_idx < mode_count && modes[mode_idx].Width != width && modes[mode_idx].Height != height, "Failed to find a different mode than %ux%u.\n", width, height); + if (mode_idx >= mode_count) + continue;
ret = ClipCursor(NULL); ok(ret, "ClipCursor failed, error %#lx.\n", GetLastError());
I believe the intent of that check *was*, simply, "mode_idx < mode_count". We can just change the ok() to that.
We don't need an "if (...)" continue afterward, either. A test failure is a test failure.
On Wed Jun 25 13:15:16 2025 +0000, Elizabeth Figura wrote:
I believe the intent of that check *was*, simply, "mode_idx < mode_count". We can just change the ok() to that. We don't need an "if (...)" continue afterward, either. A test failure is a test failure.
the `if()` is needed because there are uses of `modes[mode_idx]` later, which would be out of bound.