mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
tests/d3d12: Avoid out-of-bounds access when evaluating ok() args (ubsan).
Compiling and running with UBSan reported the following errors: tests/d3d12.c:31063:5: runtime error: index 4 out of bounds for type 'float [4][8]' tests/d3d12.c:31063:5: runtime error: index 8 out of bounds for type 'float [8]' tests/d3d12.c:31063:5: runtime error: load of address 0x557ee85a1500 with insufficient space for an object of type 'const float' tests/d3d12.c:31248:5: runtime error: index 4 out of bounds for type 'float [4][4]' tests/d3d12.c:31248:5: runtime error: index 4 out of bounds for type 'float [4]' tests/d3d12.c:31248:5: runtime error: load of address 0x557ee85a10d0 with insufficient space for an object of type 'const float'
This commit is contained in:
committed by
Henri Verbeet
parent
d65be3d0c5
commit
66d0c2a426
Notes:
Henri Verbeet
2025-06-09 16:31:32 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1544
@@ -30856,6 +30856,7 @@ static void test_domain_shader_inputs(void)
|
||||
D3D12_STREAM_OUTPUT_BUFFER_VIEW sobv;
|
||||
D3D12_INPUT_LAYOUT_DESC input_layout;
|
||||
struct d3d12_resource_readback rb;
|
||||
float got = 0.0f, expected = 0.0f;
|
||||
struct test_context_desc desc;
|
||||
struct test_context context;
|
||||
ID3D12Resource *so_buffer;
|
||||
@@ -31047,7 +31048,9 @@ static void test_domain_shader_inputs(void)
|
||||
elems = get_readback_data(&rb.rb, y, 0, 0, stride);
|
||||
for (x = 0; x < ARRAY_SIZE(*reference); ++x)
|
||||
{
|
||||
if (!compare_float(reference[y][x], elems[x], 0))
|
||||
got = elems[x];
|
||||
expected = reference[y][x];
|
||||
if (!compare_float(expected, got, 0))
|
||||
{
|
||||
fail = true;
|
||||
break;
|
||||
@@ -31058,7 +31061,7 @@ static void test_domain_shader_inputs(void)
|
||||
break;
|
||||
}
|
||||
bug_if(is_mvk_device(context.device))
|
||||
ok(!fail, "Got unexpected value %.8e for [%u][%u], expected %.8e.\n", elems[x], y, x, reference[y][x]);
|
||||
ok(!fail, "Got unexpected value %.8e for [%u][%u], expected %.8e.\n", got, y, x, expected);
|
||||
release_resource_readback(&rb);
|
||||
|
||||
ID3D12Resource_Release(so_buffer);
|
||||
@@ -31072,6 +31075,7 @@ static void test_domain_shader_one_patch_constant_input(void)
|
||||
D3D12_STREAM_OUTPUT_BUFFER_VIEW sobv;
|
||||
D3D12_INPUT_LAYOUT_DESC input_layout;
|
||||
struct d3d12_resource_readback rb;
|
||||
float got = 0.0f, expected = 0.0f;
|
||||
struct test_context_desc desc;
|
||||
struct test_context context;
|
||||
ID3D12Resource *so_buffer;
|
||||
@@ -31232,7 +31236,9 @@ static void test_domain_shader_one_patch_constant_input(void)
|
||||
elems = get_readback_data(&rb.rb, y, 0, 0, stride);
|
||||
for (x = 0; x < ARRAY_SIZE(*reference); ++x)
|
||||
{
|
||||
if (!compare_float(reference[y][x], elems[x], 0))
|
||||
got = elems[x];
|
||||
expected = reference[y][x];
|
||||
if (!compare_float(expected, got, 0))
|
||||
{
|
||||
fail = true;
|
||||
break;
|
||||
@@ -31243,7 +31249,7 @@ static void test_domain_shader_one_patch_constant_input(void)
|
||||
break;
|
||||
}
|
||||
bug_if(is_mvk_device(context.device))
|
||||
ok(!fail, "Got unexpected value %.8e for [%u][%u], expected %.8e.\n", elems[x], y, x, reference[y][x]);
|
||||
ok(!fail, "Got unexpected value %.8e for [%u][%u], expected %.8e.\n", got, y, x, expected);
|
||||
release_resource_readback(&rb);
|
||||
|
||||
ID3D12Resource_Release(so_buffer);
|
||||
|
Reference in New Issue
Block a user