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
1bcc7ce7
Commit
1bcc7ce7
authored
Jul 10, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Jul 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d10: Validate offsets and size in parse_fx10_type() (AFL).
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7f6520a2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
5 deletions
+35
-5
effect.c
dlls/d3d10/effect.c
+35
-5
No files found.
dlls/d3d10/effect.c
View file @
1bcc7ce7
...
@@ -598,11 +598,18 @@ static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
...
@@ -598,11 +598,18 @@ static D3D10_SHADER_VARIABLE_TYPE d3d10_variable_type(DWORD t, BOOL is_object)
static
HRESULT
parse_fx10_type
(
const
char
*
data
,
size_t
data_size
,
DWORD
offset
,
struct
d3d10_effect_type
*
t
)
static
HRESULT
parse_fx10_type
(
const
char
*
data
,
size_t
data_size
,
DWORD
offset
,
struct
d3d10_effect_type
*
t
)
{
{
const
char
*
ptr
=
data
+
offset
;
const
char
*
ptr
;
DWORD
unknown0
;
DWORD
unknown0
;
DWORD
typeinfo
;
DWORD
typeinfo
;
unsigned
int
i
;
unsigned
int
i
;
if
(
offset
>=
data_size
||
!
require_space
(
offset
,
6
,
sizeof
(
DWORD
),
data_size
))
{
WARN
(
"Invalid offset %#x (data size %#lx).
\n
"
,
offset
,
(
long
)
data_size
);
return
E_FAIL
;
}
ptr
=
data
+
offset
;
read_dword
(
&
ptr
,
&
offset
);
read_dword
(
&
ptr
,
&
offset
);
TRACE
(
"Type name at offset %#x.
\n
"
,
offset
);
TRACE
(
"Type name at offset %#x.
\n
"
,
offset
);
...
@@ -631,9 +638,14 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
...
@@ -631,9 +638,14 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
switch
(
unknown0
)
switch
(
unknown0
)
{
{
case
1
:
case
1
:
t
->
member_count
=
0
;
if
(
!
require_space
(
ptr
-
data
,
1
,
sizeof
(
typeinfo
),
data_size
))
{
WARN
(
"Invalid offset %#x (data size %#lx).
\n
"
,
offset
,
(
long
)
data_size
);
return
E_FAIL
;
}
read_dword
(
&
ptr
,
&
typeinfo
);
read_dword
(
&
ptr
,
&
typeinfo
);
t
->
member_count
=
0
;
t
->
column_count
=
(
typeinfo
&
D3D10_FX10_TYPE_COLUMN_MASK
)
>>
D3D10_FX10_TYPE_COLUMN_SHIFT
;
t
->
column_count
=
(
typeinfo
&
D3D10_FX10_TYPE_COLUMN_MASK
)
>>
D3D10_FX10_TYPE_COLUMN_SHIFT
;
t
->
row_count
=
(
typeinfo
&
D3D10_FX10_TYPE_ROW_MASK
)
>>
D3D10_FX10_TYPE_ROW_SHIFT
;
t
->
row_count
=
(
typeinfo
&
D3D10_FX10_TYPE_ROW_MASK
)
>>
D3D10_FX10_TYPE_ROW_SHIFT
;
t
->
basetype
=
d3d10_variable_type
((
typeinfo
&
D3D10_FX10_TYPE_BASETYPE_MASK
)
>>
D3D10_FX10_TYPE_BASETYPE_SHIFT
,
FALSE
);
t
->
basetype
=
d3d10_variable_type
((
typeinfo
&
D3D10_FX10_TYPE_BASETYPE_MASK
)
>>
D3D10_FX10_TYPE_BASETYPE_SHIFT
,
FALSE
);
...
@@ -651,13 +663,18 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
...
@@ -651,13 +663,18 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
case
2
:
case
2
:
TRACE
(
"Type is an object.
\n
"
);
TRACE
(
"Type is an object.
\n
"
);
if
(
!
require_space
(
ptr
-
data
,
1
,
sizeof
(
typeinfo
),
data_size
))
{
WARN
(
"Invalid offset %#x (data size %#lx).
\n
"
,
offset
,
(
long
)
data_size
);
return
E_FAIL
;
}
read_dword
(
&
ptr
,
&
typeinfo
);
t
->
member_count
=
0
;
t
->
member_count
=
0
;
t
->
column_count
=
0
;
t
->
column_count
=
0
;
t
->
row_count
=
0
;
t
->
row_count
=
0
;
t
->
type_class
=
D3D10_SVC_OBJECT
;
read_dword
(
&
ptr
,
&
typeinfo
);
t
->
basetype
=
d3d10_variable_type
(
typeinfo
,
TRUE
);
t
->
basetype
=
d3d10_variable_type
(
typeinfo
,
TRUE
);
t
->
type_class
=
D3D10_SVC_OBJECT
;
TRACE
(
"Type description: %#x.
\n
"
,
typeinfo
);
TRACE
(
"Type description: %#x.
\n
"
,
typeinfo
);
TRACE
(
"
\t
basetype: %s.
\n
"
,
debug_d3d10_shader_variable_type
(
t
->
basetype
));
TRACE
(
"
\t
basetype: %s.
\n
"
,
debug_d3d10_shader_variable_type
(
t
->
basetype
));
...
@@ -667,6 +684,12 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
...
@@ -667,6 +684,12 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
case
3
:
case
3
:
TRACE
(
"Type is a structure.
\n
"
);
TRACE
(
"Type is a structure.
\n
"
);
if
(
!
require_space
(
ptr
-
data
,
1
,
sizeof
(
t
->
member_count
),
data_size
))
{
WARN
(
"Invalid offset %#x (data size %#lx).
\n
"
,
offset
,
(
long
)
data_size
);
return
E_FAIL
;
}
read_dword
(
&
ptr
,
&
t
->
member_count
);
read_dword
(
&
ptr
,
&
t
->
member_count
);
TRACE
(
"Member count: %u.
\n
"
,
t
->
member_count
);
TRACE
(
"Member count: %u.
\n
"
,
t
->
member_count
);
...
@@ -681,6 +704,13 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
...
@@ -681,6 +704,13 @@ static HRESULT parse_fx10_type(const char *data, size_t data_size, DWORD offset,
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
if
(
!
require_space
(
ptr
-
data
,
t
->
member_count
,
4
*
sizeof
(
DWORD
),
data_size
))
{
WARN
(
"Invalid member count %#x (data size %#lx, offset %#x).
\n
"
,
t
->
member_count
,
(
long
)
data_size
,
offset
);
return
E_FAIL
;
}
for
(
i
=
0
;
i
<
t
->
member_count
;
++
i
)
for
(
i
=
0
;
i
<
t
->
member_count
;
++
i
)
{
{
struct
d3d10_effect_type_member
*
typem
=
&
t
->
members
[
i
];
struct
d3d10_effect_type_member
*
typem
=
&
t
->
members
[
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