vkd3d-shader/ir: Validate indices for RESOURCE registers.

This commit is contained in:
Giovanni Mascellani 2024-10-02 23:08:36 +02:00 committed by Henri Verbeet
parent ab23038367
commit 3ab68c1e46
Notes: Henri Verbeet 2024-10-03 19:35:06 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1142

View File

@ -6215,6 +6215,18 @@ static void vsir_validate_register(struct validation_context *ctx,
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION,
"Invalid dimension %#x for a RESOURCE register.",
reg->dimension);
if (reg->idx_count != 2)
{
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT,
"Invalid index count %u for a RESOURCE register.",
reg->idx_count);
break;
}
if (reg->idx[0].rel_addr)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX,
"Non-NULL relative address for the descriptor index of a RESOURCE register.");
break;
case VKD3DSPR_UAV: