Silences a very common warning.
From: Conor McCarthy cmccarthy@codeweavers.com
Silences a very common warning. --- libs/vkd3d-shader/dxbc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index d8eef8a5..73a25ae7 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -1921,9 +1921,9 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s bool has_stream_index, has_min_precision; struct vkd3d_shader_signature_element *e; const char *data = section->data.code; + uint32_t count, header_size; const char *ptr = data; unsigned int i; - uint32_t count;
if (!require_space(0, 2, sizeof(uint32_t), section->data.size)) { @@ -1934,7 +1934,20 @@ static int shader_parse_signature(const struct vkd3d_shader_dxbc_section_desc *s read_dword(&ptr, &count); TRACE("%u elements.\n", count);
- skip_dword_unknown(&ptr, 1); /* It seems to always be 0x00000008. */ + read_dword(&ptr, &header_size); + if (header_size & (sizeof(uint32_t) - 1)) + { + WARN("Header size %#x is not 32-bit aligned.\n", header_size); + return VKD3D_ERROR_INVALID_ARGUMENT; + } + header_size /= sizeof(uint32_t); + if (header_size < 2) + { + WARN("Invalid header size %u.\n", header_size); + header_size = 2; + } + for (header_size -= 2; header_size; --header_size) + skip_dword_unknown(&ptr, 1);
if (!require_space(ptr - data, count, 6 * sizeof(uint32_t), section->data.size)) {