Avoid writing out of bounds.
Signed-off-by: YeshunYe yeyeshun@uniontech.com
-- v3: dsound/tests: Add test for DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1 dsound: Check if 'cbPropData' for DSPROPERTY_Description1 is large enough
From: YeshunYe yeyeshun@uniontech.com
Avoid writing out of bounds.
Signed-off-by: YeshunYe yeyeshun@uniontech.com --- dlls/dsound/propset.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/dsound/propset.c b/dlls/dsound/propset.c index be284a6dda5..28df7887f65 100644 --- a/dlls/dsound/propset.c +++ b/dlls/dsound/propset.c @@ -475,6 +475,8 @@ static HRESULT DSPROPERTY_Description1( *pcbReturned = sizeof(*ppd); if (!pPropData) return S_OK; + if (cbPropData < sizeof(*ppd)) + return E_INVALIDARG;
data.DeviceId = ppd->DeviceId; data.DataFlow = ppd->DataFlow;
From: YeshunYe yeyeshun@uniontech.com
Signed-off-by: YeshunYe yeyeshun@uniontech.com --- dlls/dsound/tests/propset.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/dsound/tests/propset.c b/dlls/dsound/tests/propset.c index 71040a70c77..88c5132bc6c 100644 --- a/dlls/dsound/tests/propset.c +++ b/dlls/dsound/tests/propset.c @@ -300,6 +300,20 @@ static void propset_private_tests(void) "Shouldn't be able to set DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1: " "support = 0x%lx\n",support);
+ if (support & KSPROPERTY_SUPPORT_GET) { + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1_DATA data; + ULONG bytes; + data.DeviceId = DSDEVID_DefaultPlayback; + + rc = IKsPropertySet_Get(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1, + NULL, 0, &data, sizeof(data) - 1, &bytes); + ok(rc==E_INVALIDARG, "Query buffer size failed: 0x%lx\n",rc); + rc = IKsPropertySet_Get(pps, &DSPROPSETID_DirectSoundDevice, + DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_1, + NULL, 0, &data, sizeof(data), &bytes); + ok(rc==DS_OK, "Couldn't get description: 0x%lx\n",rc); + } /* test DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A */ rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice, DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_A,
On Mon Jul 21 07:03:55 2025 +0000, Yeshun Ye wrote:
changed this line in [version 3 of the diff](/wine/wine/-/merge_requests/8596/diffs?diff_id=194454&start_sha=7484d3398d6625e47e99f637cd7e4dc782199071#d01bc7bc697ece7b029e02f1f71cdf9aaea5cf4f_308_304)
done
This merge request was approved by Huw Davies.