vkd3d-shader/ir: Validate index count for MISCTYPE registers.

This commit is contained in:
Giovanni Mascellani 2024-09-26 21:34:27 +02:00 committed by Henri Verbeet
parent 99aebb1b31
commit 7e9dc8da97
Notes: Henri Verbeet 2024-10-02 22:38:04 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1136

View File

@ -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;
}