Conor McCarthy : vkd3d: Reject overflowing descriptor ranges.

Alexandre Julliard julliard at winehq.org
Wed Oct 13 15:53:07 CDT 2021


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

Author: Conor McCarthy <cmccarthy at codeweavers.com>
Date:   Tue Oct 12 23:50:25 2021 +1000

vkd3d: Reject overflowing descriptor ranges.

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 | 7 +++++++
 tests/d3d12.c      | 3 ---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c
index 3acf042..277afe4 100644
--- a/libs/vkd3d/state.c
+++ b/libs/vkd3d/state.c
@@ -350,6 +350,13 @@ static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_sig
             return E_INVALIDARG;
         }
 
+        if (range->NumDescriptors != UINT_MAX && !vkd3d_bound_range(range->BaseShaderRegister,
+                range->NumDescriptors, UINT_MAX))
+        {
+            WARN("A descriptor range overflows.\n");
+            return E_INVALIDARG;
+        }
+
         if (unbounded && range->OffsetInDescriptorsFromTableStart == D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
         {
             WARN("An unbounded range with offset D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND occurs after "
diff --git a/tests/d3d12.c b/tests/d3d12.c
index 6ae9df3..4e908d4 100644
--- a/tests/d3d12.c
+++ b/tests/d3d12.c
@@ -2715,10 +2715,7 @@ static void test_create_root_signature(void)
     descriptor_ranges[0].BaseShaderRegister = 0xfffff001;
     root_parameters[0].DescriptorTable.NumDescriptorRanges = 1;
     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);
 
     /* empty root signature */
     root_signature_desc.NumParameters = 0;




More information about the wine-cvs mailing list