wined3d: Validate byte code pointer in shader_init().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-10-03 12:32:22 +02:00 committed by Alexandre Julliard
parent 7c90361833
commit 0e35782fe8
1 changed files with 3 additions and 18 deletions

View File

@ -3699,6 +3699,9 @@ static HRESULT shader_init(struct wined3d_shader *shader, struct wined3d_device
TRACE("byte_code %p, byte_code_size %#lx, format %#x.\n",
desc->byte_code, (long)desc->byte_code_size, desc->format);
if (!desc->byte_code)
return WINED3DERR_INVALIDCALL;
if (!(shader->frontend = shader_select_frontend(desc->format)))
{
FIXME("Unable to find frontend for shader.\n");
@ -4251,9 +4254,6 @@ HRESULT CDECL wined3d_shader_create_cs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!desc->byte_code)
return WINED3DERR_INVALIDCALL;
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -4288,9 +4288,6 @@ HRESULT CDECL wined3d_shader_create_ds(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!desc->byte_code)
return WINED3DERR_INVALIDCALL;
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -4326,9 +4323,6 @@ HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, so_desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, so_desc, parent, parent_ops, shader);
if (!desc->byte_code)
return WINED3DERR_INVALIDCALL;
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -4356,9 +4350,6 @@ HRESULT CDECL wined3d_shader_create_hs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!desc->byte_code)
return WINED3DERR_INVALIDCALL;
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -4393,9 +4384,6 @@ HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!desc->byte_code)
return WINED3DERR_INVALIDCALL;
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
@ -4423,9 +4411,6 @@ HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const stru
TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n",
device, desc, parent, parent_ops, shader);
if (!desc->byte_code)
return WINED3DERR_INVALIDCALL;
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;