mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/ir: Validate register indices.
This commit is contained in:
parent
b7aeb5dd70
commit
12fcb8dcc6
Notes:
Alexandre Julliard
2023-11-10 00:10:44 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/462
@ -1488,10 +1488,13 @@ static void VKD3D_PRINTF_FUNC(3, 4) validator_error(struct validation_context *c
|
||||
vkd3d_string_buffer_cleanup(&buf);
|
||||
}
|
||||
|
||||
static void vsir_validate_src_param(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_src_param *src);
|
||||
|
||||
static void vsir_validate_register(struct validation_context *ctx,
|
||||
const struct vkd3d_shader_register *reg)
|
||||
{
|
||||
unsigned int temp_count = ctx->temp_count;
|
||||
unsigned int i, temp_count = ctx->temp_count;
|
||||
|
||||
/* SM1-3 shaders do not include a DCL_TEMPS instruction. */
|
||||
if (ctx->parser->shader_version.major <= 3)
|
||||
@ -1517,6 +1520,13 @@ static void vsir_validate_register(struct validation_context *ctx,
|
||||
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid register index count %u.",
|
||||
reg->idx_count);
|
||||
|
||||
for (i = 0; i < min(reg->idx_count, ARRAY_SIZE(reg->idx)); ++i)
|
||||
{
|
||||
const struct vkd3d_shader_src_param *param = reg->idx[i].rel_addr;
|
||||
if (reg->idx[i].rel_addr)
|
||||
vsir_validate_src_param(ctx, param);
|
||||
}
|
||||
|
||||
switch (reg->type)
|
||||
{
|
||||
case VKD3DSPR_TEMP:
|
||||
|
Loading…
Reference in New Issue
Block a user