Conor McCarthy : vkd3d: Return E_INVALIDARG if a descriptor range overflows.

Alexandre Julliard julliard at winehq.org
Tue Aug 3 16:51:52 CDT 2021


Module: vkd3d
Branch: master
Commit: 1c96f76afcae66666afb4fd8acc478f1a2f3f9e6
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=1c96f76afcae66666afb4fd8acc478f1a2f3f9e6

Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date:   Tue Aug  3 00:43:17 2021 +1000

vkd3d: Return E_INVALIDARG if a descriptor range overflows.

Signed-off-by: Conor McCarthy <cmccarthy at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d/state.c | 3 +++
 tests/d3d12.c      | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index daa907b..102201d 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -612,6 +612,9 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
             if (range->OffsetInDescriptorsFromTableStart != D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
                 offset = range->OffsetInDescriptorsFromTableStart;
 
+            if (!vkd3d_bound_range(offset, range->NumDescriptors, UINT_MAX))
+                return E_INVALIDARG;
+
             table->ranges[j].offset = offset;
             table->ranges[j].descriptor_count = range->NumDescriptors;
             table->ranges[j].descriptor_magic = vkd3d_descriptor_magic_from_d3d12(range->RangeType);
diff --git a/tests/d3d12.c b/tests/d3d12.c
index b930855..9e61fd6 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -2870,10 +2870,7 @@ static void test_root_signature_limits(void)
     descriptor_ranges[0].NumDescriptors = 0x1001;
     descriptor_ranges[0].OffsetInDescriptorsFromTableStart = 0xfffff000;
     hr = create_root_signature(device, &root_signature_desc, &root_signature);
-    todo
     ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
-    if (SUCCEEDED(hr))
-        ID3D12RootSignature_Release(root_signature);
 
     refcount = ID3D12Device_Release(device);
     ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount);




More information about the wine-cvs mailing list