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
a9a80b56
Commit
a9a80b56
authored
Apr 13, 2015
by
Andrew Eikum
Committed by
Alexandre Julliard
Apr 14, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dsound: Stricter validation for formats in secondary buffers.
parent
80428310
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
dsound.c
dlls/dsound/dsound.c
+19
-5
dsound.c
dlls/dsound/tests/dsound.c
+0
-0
No files found.
dlls/dsound/dsound.c
View file @
a9a80b56
...
...
@@ -470,17 +470,32 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
}
}
else
{
IDirectSoundBufferImpl
*
dsb
;
WAVEFORMATEXTENSIBLE
*
pwfxe
;
if
(
dsbd
->
lpwfxFormat
==
NULL
)
{
WARN
(
"invalid parameter: dsbd->lpwfxFormat can't be NULL for "
"secondary buffer
\n
"
);
return
DSERR_INVALIDPARAM
;
}
pwfxe
=
(
WAVEFORMATEXTENSIBLE
*
)
dsbd
->
lpwfxFormat
;
if
(
pwfxe
->
Format
.
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
)
if
(
dsbd
->
lpwfxFormat
->
wFormatTag
!=
WAVE_FORMAT_PCM
&&
dsbd
->
lpwfxFormat
->
wFormatTag
!=
WAVE_FORMAT_IEEE_FLOAT
&&
dsbd
->
lpwfxFormat
->
wFormatTag
!=
WAVE_FORMAT_EXTENSIBLE
)
{
WARN
(
"We can't mix this format: 0x%x
\n
"
,
dsbd
->
lpwfxFormat
->
wFormatTag
);
return
E_NOTIMPL
;
}
if
(
dsbd
->
lpwfxFormat
->
wBitsPerSample
<
8
||
dsbd
->
lpwfxFormat
->
wBitsPerSample
%
8
!=
0
||
dsbd
->
lpwfxFormat
->
nChannels
==
0
||
dsbd
->
lpwfxFormat
->
nSamplesPerSec
==
0
||
dsbd
->
lpwfxFormat
->
nAvgBytesPerSec
==
0
||
dsbd
->
lpwfxFormat
->
nBlockAlign
!=
dsbd
->
lpwfxFormat
->
nChannels
*
dsbd
->
lpwfxFormat
->
wBitsPerSample
/
8
)
{
WARN
(
"Format inconsistency
\n
"
);
return
DSERR_INVALIDPARAM
;
}
if
(
dsbd
->
lpwfxFormat
->
wFormatTag
==
WAVE_FORMAT_EXTENSIBLE
)
{
WAVEFORMATEXTENSIBLE
*
pwfxe
=
(
WAVEFORMATEXTENSIBLE
*
)
dsbd
->
lpwfxFormat
;
/* check if cbSize is at least 22 bytes */
if
(
pwfxe
->
Format
.
cbSize
<
(
sizeof
(
WAVEFORMATEXTENSIBLE
)
-
sizeof
(
WAVEFORMATEX
)))
{
...
...
@@ -510,8 +525,7 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
}
if
(
pwfxe
->
Samples
.
wValidBitsPerSample
&&
pwfxe
->
Samples
.
wValidBitsPerSample
<
dsbd
->
lpwfxFormat
->
wBitsPerSample
)
{
FIXME
(
"Non-packed formats not supported right now: %d/%d
\n
"
,
pwfxe
->
Samples
.
wValidBitsPerSample
,
dsbd
->
lpwfxFormat
->
wBitsPerSample
);
return
DSERR_CONTROLUNAVAIL
;
WARN
(
"Non-packed formats may not function : %d/%d
\n
"
,
pwfxe
->
Samples
.
wValidBitsPerSample
,
dsbd
->
lpwfxFormat
->
wBitsPerSample
);
}
}
...
...
dlls/dsound/tests/dsound.c
View file @
a9a80b56
This diff is collapsed.
Click to expand it.
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