Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
d499073c
Commit
d499073c
authored
Jan 27, 2010
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Catch invalid buffer map parameters.
parent
0c46da86
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletion
+34
-1
buffer.c
dlls/wined3d/buffer.c
+34
-1
No files found.
dlls/wined3d/buffer.c
View file @
d499073c
...
...
@@ -56,7 +56,13 @@ static inline BOOL buffer_add_dirty_area(struct wined3d_buffer *This, UINT offse
}
}
if
(
!
offset
&&
!
size
)
if
(
offset
>
This
->
resource
.
size
||
offset
+
size
>
This
->
resource
.
size
)
{
WARN
(
"Invalid range dirtified, marking entire buffer dirty
\n
"
);
offset
=
0
;
size
=
This
->
resource
.
size
;
}
else
if
(
!
offset
&&
!
size
)
{
size
=
This
->
resource
.
size
;
}
...
...
@@ -1026,6 +1032,32 @@ static WINED3DRESOURCETYPE STDMETHODCALLTYPE buffer_GetType(IWineD3DBuffer *ifac
/* IWineD3DBuffer methods */
static
DWORD
buffer_sanitize_flags
(
DWORD
flags
)
{
/* Not all flags make sense together, but Windows never returns an error. Catch the
* cases that could cause issues */
if
(
flags
&
WINED3DLOCK_READONLY
)
{
if
(
flags
&
WINED3DLOCK_DISCARD
)
{
WARN
(
"WINED3DLOCK_READONLY combined with WINED3DLOCK_DISCARD, ignoring flags
\n
"
);
return
0
;
}
if
(
flags
&
WINED3DLOCK_NOOVERWRITE
)
{
WARN
(
"WINED3DLOCK_READONLY combined with WINED3DLOCK_NOOVERWRITE, ignoring flags
\n
"
);
return
0
;
}
}
else
if
((
flags
&
(
WINED3DLOCK_DISCARD
|
WINED3DLOCK_NOOVERWRITE
))
==
(
WINED3DLOCK_DISCARD
|
WINED3DLOCK_NOOVERWRITE
))
{
WARN
(
"WINED3DLOCK_DISCARD and WINED3DLOCK_NOOVERWRITE used together, ignoring
\n
"
);
return
0
;
}
return
flags
;
}
static
HRESULT
STDMETHODCALLTYPE
buffer_Map
(
IWineD3DBuffer
*
iface
,
UINT
offset
,
UINT
size
,
BYTE
**
data
,
DWORD
flags
)
{
struct
wined3d_buffer
*
This
=
(
struct
wined3d_buffer
*
)
iface
;
...
...
@@ -1033,6 +1065,7 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset,
TRACE
(
"iface %p, offset %u, size %u, data %p, flags %#x
\n
"
,
iface
,
offset
,
size
,
data
,
flags
);
flags
=
buffer_sanitize_flags
(
flags
);
if
(
!
buffer_add_dirty_area
(
This
,
offset
,
size
))
return
E_OUTOFMEMORY
;
count
=
InterlockedIncrement
(
&
This
->
lock_count
);
...
...
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