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
994c5618
Commit
994c5618
authored
May 24, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
May 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d10: Validate offsets and sizes in parse_dxbc() (AFL).
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e5a4da38
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
d3d10_private.h
dlls/d3d10/d3d10_private.h
+5
-0
utils.c
dlls/d3d10/utils.c
+12
-0
No files found.
dlls/d3d10/d3d10_private.h
View file @
994c5618
...
@@ -294,6 +294,11 @@ static inline void write_dword(char **ptr, DWORD d)
...
@@ -294,6 +294,11 @@ static inline void write_dword(char **ptr, DWORD d)
*
ptr
+=
sizeof
(
d
);
*
ptr
+=
sizeof
(
d
);
}
}
static
inline
BOOL
require_space
(
size_t
offset
,
size_t
size
,
size_t
data_size
)
{
return
data_size
-
offset
>=
size
;
}
void
skip_dword_unknown
(
const
char
*
location
,
const
char
**
ptr
,
unsigned
int
count
)
DECLSPEC_HIDDEN
;
void
skip_dword_unknown
(
const
char
*
location
,
const
char
**
ptr
,
unsigned
int
count
)
DECLSPEC_HIDDEN
;
void
write_dword_unknown
(
char
**
ptr
,
DWORD
d
)
DECLSPEC_HIDDEN
;
void
write_dword_unknown
(
char
**
ptr
,
DWORD
d
)
DECLSPEC_HIDDEN
;
...
...
dlls/d3d10/utils.c
View file @
994c5618
...
@@ -217,11 +217,23 @@ HRESULT parse_dxbc(const char *data, SIZE_T data_size,
...
@@ -217,11 +217,23 @@ HRESULT parse_dxbc(const char *data, SIZE_T data_size,
read_dword
(
&
ptr
,
&
chunk_offset
);
read_dword
(
&
ptr
,
&
chunk_offset
);
TRACE
(
"chunk %u at offset %#x
\n
"
,
i
,
chunk_offset
);
TRACE
(
"chunk %u at offset %#x
\n
"
,
i
,
chunk_offset
);
if
(
chunk_offset
>=
data_size
||
!
require_space
(
chunk_offset
,
2
*
sizeof
(
DWORD
),
data_size
))
{
WARN
(
"Invalid chunk offset %#x (data size %#lx).
\n
"
,
chunk_offset
,
data_size
);
return
E_FAIL
;
}
chunk_ptr
=
data
+
chunk_offset
;
chunk_ptr
=
data
+
chunk_offset
;
read_dword
(
&
chunk_ptr
,
&
chunk_tag
);
read_dword
(
&
chunk_ptr
,
&
chunk_tag
);
read_dword
(
&
chunk_ptr
,
&
chunk_size
);
read_dword
(
&
chunk_ptr
,
&
chunk_size
);
if
(
!
require_space
(
chunk_ptr
-
data
,
chunk_size
,
data_size
))
{
WARN
(
"Invalid chunk size %#x (data size %#lx, chunk offset %#x).
\n
"
,
chunk_size
,
data_size
,
chunk_offset
);
return
E_FAIL
;
}
hr
=
chunk_handler
(
chunk_ptr
,
chunk_size
,
chunk_tag
,
ctx
);
hr
=
chunk_handler
(
chunk_ptr
,
chunk_size
,
chunk_tag
,
ctx
);
if
(
FAILED
(
hr
))
break
;
if
(
FAILED
(
hr
))
break
;
}
}
...
...
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