Commit de82b55b authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Refuse to parse shaders with an invalid version token.

parent 5fbe5ee0
...@@ -506,7 +506,18 @@ static int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const D ...@@ -506,7 +506,18 @@ static int shader_skip_unrecognized(const struct wined3d_sm1_data *priv, const D
static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature) static void *shader_sm1_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature)
{ {
struct wined3d_sm1_data *priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv)); struct wined3d_sm1_data *priv;
BYTE major, minor;
major = WINED3D_SM1_VERSION_MAJOR(*byte_code);
minor = WINED3D_SM1_VERSION_MINOR(*byte_code);
if (WINED3D_SHADER_VERSION(major, minor) > WINED3D_SHADER_VERSION(3, 0))
{
WARN("Invalid shader version %u.%u (%#x).\n", major, minor, *byte_code);
return NULL;
}
priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv));
if (!priv) if (!priv)
{ {
ERR("Failed to allocate private data\n"); ERR("Failed to allocate private data\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment