[PATCH vkd3d v2 3/3] vkd3d-shader: Emit SPIR-V for descriptor arrays and arrayed bindings.

Henri Verbeet hverbeet at gmail.com
Wed Jun 16 03:01:44 CDT 2021


On Wed, 16 Jun 2021 at 08:14, Conor McCarthy <cmccarthy at codeweavers.com> wrote:
> June 15, 2021 12:39 AM, "Henri Verbeet" <hverbeet at gmail.com> wrote:
> >> + || current->register_index > register_first
> >> + || current->register_index + current->binding.count <= register_last)
> >> continue;
> >
> > "current->register_index + current->binding.count" can overflow.
>
> The result would be it doesn't match any binding. We could emit an error, but I think overflow should be checked in d3d12_root_signature_append_vk_binding() in state.c. Other uses of vkd3d-shader could send this type of invalid binding, but I think the resulting "Could not find binding" is accurate enough.

Well, it would be a nominally valid binding. Setting "binding.count =
~0u" in particular would trigger this, but even if the caller set a
binding count that's larger than the Vulkan descriptor limits, that
would be no reason for vkd3d-shader to reject the binding. Beyond
that, I think it's simply good practice to write range checks like
this in a way that avoids the overflow. I.e., "current->binding.count
<= register_last - current->register_index".



More information about the wine-devel mailing list