libs/vkd3d-shader: Validate the DXBC version.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-01-15 19:49:24 +03:30 committed by Alexandre Julliard
parent 12ca2bbcf6
commit 2d8e2fbe86

View File

@ -1814,6 +1814,7 @@ static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
DWORD chunk_count;
DWORD total_size;
unsigned int i;
DWORD version;
DWORD tag;
read_dword(&ptr, &tag);
@ -1828,7 +1829,13 @@ static HRESULT parse_dxbc(const char *data, SIZE_T data_size,
WARN("Ignoring DXBC checksum.\n");
skip_dword_unknown(&ptr, 4);
skip_dword_unknown(&ptr, 1); /* It seems to always be 0x00000001. */
read_dword(&ptr, &version);
TRACE("version: %#x.\n", version);
if (version != 0x00000001)
{
WARN("Got unexpected DXBC version %#x.\n", version);
return E_INVALIDARG;
}
read_dword(&ptr, &total_size);
TRACE("total size: %#x\n", total_size);