From 7e9dc8da978f92d1ada82c193dd0742cd671c358 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Thu, 26 Sep 2024 21:34:27 +0200 Subject: [PATCH] vkd3d-shader/ir: Validate index count for MISCTYPE registers. --- libs/vkd3d-shader/ir.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/vkd3d-shader/ir.c b/libs/vkd3d-shader/ir.c index a1ed3dc8..2fe54721 100644 --- a/libs/vkd3d-shader/ir.c +++ b/libs/vkd3d-shader/ir.c @@ -6262,6 +6262,24 @@ static void vsir_validate_register(struct validation_context *ctx, "Invalid offset for a RASTOUT register."); break; + case VKD3DSPR_MISCTYPE: + if (reg->idx_count != 1) + { + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT, + "Invalid index count %u for a MISCTYPE 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 a MISCTYPE register."); + + if (reg->idx[0].offset >= 2) + validator_error(ctx, VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX, + "Invalid offset for a MISCTYPE register."); + break; + default: break; }