d3d10: Add data and size check to parse_dxbc().

This commit is contained in:
Rico Schüller 2010-07-19 21:48:41 +02:00 committed by Alexandre Julliard
parent 53ea5de666
commit 51c2542631
1 changed files with 12 additions and 0 deletions

View File

@ -141,6 +141,12 @@ HRESULT parse_dxbc(const char *data, SIZE_T data_size,
unsigned int i; unsigned int i;
DWORD tag; DWORD tag;
if (!data)
{
WARN("No data supplied.\n");
return E_FAIL;
}
read_dword(&ptr, &tag); read_dword(&ptr, &tag);
TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4)); TRACE("tag: %s.\n", debugstr_an((const char *)&tag, 4));
@ -158,6 +164,12 @@ HRESULT parse_dxbc(const char *data, SIZE_T data_size,
read_dword(&ptr, &total_size); read_dword(&ptr, &total_size);
TRACE("total size: %#x\n", total_size); TRACE("total size: %#x\n", total_size);
if (data_size != total_size)
{
WARN("Wrong size supplied.\n");
return E_FAIL;
}
read_dword(&ptr, &chunk_count); read_dword(&ptr, &chunk_count);
TRACE("chunk count: %#x\n", chunk_count); TRACE("chunk count: %#x\n", chunk_count);