vkd3d-shader/ir: Validate the register index count.

This commit is contained in:
Giovanni Mascellani 2023-10-24 19:46:07 -05:00 committed by Alexandre Julliard
parent 26e4191d4b
commit 79fa5fd8bb
Notes: Alexandre Julliard 2023-11-02 22:49:42 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/432
2 changed files with 5 additions and 0 deletions

View File

@ -1510,6 +1510,10 @@ static void vsir_validate_register(struct validation_context *ctx,
if (reg->dimension >= VSIR_DIMENSION_COUNT)
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION, "Invalid register dimension %#x.",
reg->dimension);
if (reg->idx_count > ARRAY_SIZE(reg->idx))
validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, "Invalid register index count %u.",
reg->idx_count);
}
static void vsir_validate_dst_param(struct validation_context *ctx,

View File

@ -203,6 +203,7 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION = 9007,
VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE = 9008,
VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION = 9009,
VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT = 9010,
};
enum vkd3d_shader_opcode