Open
Description
We currently have the "DescriptorTableView" load a DirectX::DescriptorTable
with a type like so:
struct DescriptorTable {
uint32_t NumRanges;
uint32_t RangesOffset;
ViewArray<dxbc::RTS0::v2::DescriptorRange> Ranges;
};
However, we set up the ranges view like so:
size_t RangeSize = sizeof(dxbc::RTS0::v1::DescriptorRange);
if (Version > 1)
RangeSize = sizeof(dxbc::RTS0::v2::DescriptorRange);
Table.Ranges.Stride = RangeSize;
Table.Ranges.Data =
ParamData.substr(2 * sizeof(uint32_t), Table.NumRanges * RangeSize);
This invokes undefined behaviour. It is not legal to store a dxbc::RTS0::v1::DescriptorRange
in an object of type dxbc::RTS0::v2::DescriptorRange
(the inheritance is in the other direction. Furthermore, dxbc::RTS0::v2::DescriptorRange
will not fit in sizeof(dxbc::RTS0::v1::DescriptorRange)
, and the last field (currently Flags
) will overlap with the next object.
Note: this may become moot depending on the fix to #145438, as that issue implies that we won't be able to have an inheritance relationship between the versions of DescriptorRange at all.
Metadata
Metadata
Assignees
Type
Projects
Status
No status