mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/dxil: Validate the function block count.
This commit is contained in:
parent
61a550017f
commit
58d6e44501
Notes:
Alexandre Julliard
2023-08-30 23:19:25 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/283
@ -1911,6 +1911,14 @@ static enum vkd3d_result sm6_parser_function_init(struct sm6_parser *sm6, const
|
||||
{
|
||||
sm6->p.location.column = i;
|
||||
|
||||
if (!code_block)
|
||||
{
|
||||
WARN("Invalid block count %zu.\n", function->block_count);
|
||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
||||
"Invalid block count %zu.", function->block_count);
|
||||
return VKD3D_ERROR_INVALID_SHADER;
|
||||
}
|
||||
|
||||
/* block->record_count - 1 is the instruction count, but some instructions
|
||||
* can emit >1 IR instruction, so extra may be used. */
|
||||
if (!vkd3d_array_reserve((void **)&code_block->instructions, &code_block->instruction_capacity,
|
||||
|
@ -173,6 +173,7 @@ enum vkd3d_shader_error
|
||||
VKD3D_SHADER_ERROR_DXIL_INVALID_FUNCTION_DCL = 8009,
|
||||
VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_ID = 8010,
|
||||
VKD3D_SHADER_ERROR_DXIL_INVALID_MODULE = 8011,
|
||||
VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND = 8012,
|
||||
|
||||
VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER = 8300,
|
||||
VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE = 8301,
|
||||
|
Loading…
Reference in New Issue
Block a user