vkd3d-shader: Add compiler messages for invalid DXBC chunk offsets and sizes.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-07-23 13:41:29 +04:30 committed by Alexandre Julliard
parent 29e9cf032c
commit 29287d3368
2 changed files with 7 additions and 0 deletions

View File

@ -2015,6 +2015,8 @@ static int parse_dxbc(const char *data, size_t data_size, struct vkd3d_shader_me
if (chunk_offset >= data_size || !require_space(chunk_offset, 2, sizeof(DWORD), data_size))
{
WARN("Invalid chunk offset %#x (data size %zu).\n", chunk_offset, data_size);
vkd3d_shader_error(message_context, VKD3D_SHADER_ERROR_DXBC_INVALID_CHUNK_OFFSET,
"DXBC chunk %u has invalid offset %#x (data size %#zx).", i, chunk_offset, data_size);
return VKD3D_ERROR_INVALID_ARGUMENT;
}
@ -2027,6 +2029,9 @@ static int parse_dxbc(const char *data, size_t data_size, struct vkd3d_shader_me
{
WARN("Invalid chunk size %#x (data size %zu, chunk offset %#x).\n",
chunk_size, data_size, chunk_offset);
vkd3d_shader_error(message_context, VKD3D_SHADER_ERROR_DXBC_INVALID_CHUNK_SIZE,
"DXBC chunk %u has invalid size %#x (data size %#zx, chunk offset %#x).",
i, chunk_offset, data_size, chunk_offset);
return VKD3D_ERROR_INVALID_ARGUMENT;
}

View File

@ -65,6 +65,8 @@ enum vkd3d_shader_error
VKD3D_SHADER_ERROR_DXBC_INVALID_MAGIC = 2,
VKD3D_SHADER_ERROR_DXBC_INVALID_CHECKSUM = 3,
VKD3D_SHADER_ERROR_DXBC_INVALID_VERSION = 4,
VKD3D_SHADER_ERROR_DXBC_INVALID_CHUNK_OFFSET = 5,
VKD3D_SHADER_ERROR_DXBC_INVALID_CHUNK_SIZE = 6,
};
enum VKD3D_SHADER_INSTRUCTION_HANDLER