Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
718f7fd4
Commit
718f7fd4
authored
Oct 23, 2018
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Validate the initial texture data before initialising the texture.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e52a20f5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
texture.c
dlls/wined3d/texture.c
+15
-15
No files found.
dlls/wined3d/texture.c
View file @
718f7fd4
...
...
@@ -3568,8 +3568,10 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
UINT
layer_count
,
UINT
level_count
,
DWORD
flags
,
const
struct
wined3d_sub_resource_data
*
data
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
struct
wined3d_texture
**
texture
)
{
unsigned
int
sub_count
=
level_count
*
layer_count
;
const
struct
wined3d_texture_ops
*
texture_ops
;
struct
wined3d_texture
*
object
;
unsigned
int
i
;
HRESULT
hr
;
TRACE
(
"device %p, desc %p, layer_count %u, level_count %u, flags %#x, data %p, "
...
...
@@ -3630,8 +3632,19 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
return
WINED3DERR_INVALIDCALL
;
}
if
(
!
(
object
=
heap_alloc_zero
(
FIELD_OFFSET
(
struct
wined3d_texture
,
sub_resources
[
level_count
*
layer_count
]))))
if
(
data
)
{
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
if
(
data
[
i
].
data
)
continue
;
WARN
(
"Invalid sub-resource data specified for sub-resource %u.
\n
"
,
i
);
return
E_INVALIDARG
;
}
}
if
(
!
(
object
=
heap_alloc_zero
(
FIELD_OFFSET
(
struct
wined3d_texture
,
sub_resources
[
sub_count
]))))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
wined3d_texture_init
(
object
,
desc
,
layer_count
,
...
...
@@ -3646,21 +3659,8 @@ HRESULT CDECL wined3d_texture_create(struct wined3d_device *device, const struct
* in this case. */
if
(
data
)
{
unsigned
int
sub_count
=
level_count
*
layer_count
;
unsigned
int
level
,
width
,
height
,
depth
;
struct
wined3d_box
box
;
unsigned
int
i
;
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
if
(
!
data
[
i
].
data
)
{
WARN
(
"Invalid sub-resource data specified for sub-resource %u.
\n
"
,
i
);
wined3d_texture_cleanup_sync
(
object
);
heap_free
(
object
);
return
E_INVALIDARG
;
}
}
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment