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
1941a915
Commit
1941a915
authored
Dec 07, 2023
by
Yuxuan Shui
Committed by
Alexandre Julliard
Dec 07, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Set position past the end of the buffer is invalid.
parent
9a42affc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
buffer.c
dlls/dsound/buffer.c
+5
-2
dsound.c
dlls/dsound/tests/dsound.c
+7
-0
No files found.
dlls/dsound/buffer.c
View file @
1941a915
...
@@ -574,12 +574,15 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(IDirectSoundBuff
...
@@ -574,12 +574,15 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetCurrentPosition(IDirectSoundBuff
IDirectSoundBufferImpl
*
This
=
impl_from_IDirectSoundBuffer8
(
iface
);
IDirectSoundBufferImpl
*
This
=
impl_from_IDirectSoundBuffer8
(
iface
);
HRESULT
hres
=
DS_OK
;
HRESULT
hres
=
DS_OK
;
TRACE
(
"(%p,%ld)
\n
"
,
This
,
newpos
);
TRACE
(
"(%p,%lu)
\n
"
,
This
,
newpos
);
if
(
newpos
>=
This
->
buflen
)
{
return
E_INVALIDARG
;
}
AcquireSRWLockExclusive
(
&
This
->
lock
);
AcquireSRWLockExclusive
(
&
This
->
lock
);
/* start mixing from this new location instead */
/* start mixing from this new location instead */
newpos
%=
This
->
buflen
;
newpos
-=
newpos
%
This
->
pwfx
->
nBlockAlign
;
newpos
-=
newpos
%
This
->
pwfx
->
nBlockAlign
;
This
->
sec_mixpos
=
newpos
;
This
->
sec_mixpos
=
newpos
;
...
...
dlls/dsound/tests/dsound.c
View file @
1941a915
...
@@ -919,6 +919,13 @@ static HRESULT test_block_align(LPGUID lpGuid)
...
@@ -919,6 +919,13 @@ static HRESULT test_block_align(LPGUID lpGuid)
rc
=
IDirectSoundBuffer_GetCurrentPosition
(
secondary
,
&
pos2
,
NULL
);
rc
=
IDirectSoundBuffer_GetCurrentPosition
(
secondary
,
&
pos2
,
NULL
);
ok
(
rc
==
DS_OK
,
"Could not get new position: %08lx
\n
"
,
rc
);
ok
(
rc
==
DS_OK
,
"Could not get new position: %08lx
\n
"
,
rc
);
ok
(
pos
==
pos2
,
"Positions not the same! Old position: %ld, new position: %ld
\n
"
,
pos
,
pos2
);
ok
(
pos
==
pos2
,
"Positions not the same! Old position: %ld, new position: %ld
\n
"
,
pos
,
pos2
);
/* Set position to past the end of the buffer */
rc
=
IDirectSoundBuffer_SetCurrentPosition
(
secondary
,
wfx
.
nAvgBytesPerSec
+
100
);
ok
(
rc
==
E_INVALIDARG
,
"Set position to %lu succeeded
\n
"
,
wfx
.
nAvgBytesPerSec
+
100
);
rc
=
IDirectSoundBuffer_GetCurrentPosition
(
secondary
,
&
pos2
,
NULL
);
ok
(
rc
==
DS_OK
,
"Could not get new position: %08lx
\n
"
,
rc
);
ok
(
pos
==
pos2
,
"Positions not the same! Old position: %ld, new position: %ld
\n
"
,
pos
,
pos2
);
}
}
ref
=
IDirectSoundBuffer_Release
(
secondary
);
ref
=
IDirectSoundBuffer_Release
(
secondary
);
ok
(
ref
==
0
,
"IDirectSoundBuffer_Release() secondary has %d references, "
ok
(
ref
==
0
,
"IDirectSoundBuffer_Release() secondary has %d references, "
...
...
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