Compare commits

...

5 commits

Author SHA1 Message Date
Aida Jonikienė
3a42ff12bb Merge branch 'mr/gtasa-earrape' into 'master'
dsound: Reject NaN values in some functions.

See merge request wine/wine!6289
2024-11-16 12:32:11 +00:00
Aida Jonikienė
86d9cd2260 dsound/tests: Add a NaN test for IDirectSound3DListener::SetOrientation(). 2024-08-15 20:55:55 +03:00
Aida Jonikienė
cf65238325 dsound/tests: Add a NaN test for IDirectSound3DBuffer::SetPosition(). 2024-08-15 20:54:16 +03:00
Aida Jonikienė
7662d607a0 dsound: Reject NaN values in IDirectSound3DListener::SetOrientation().
GTA San Andreas calls this function with NaN positions under certain
circumstances which eventually results in dwTotalAmpFactor value
being really high (and causing extremely loud audio output).
2024-08-15 20:32:33 +03:00
Aida Jonikienė
f0620f1681 dsound: Reject NaN values in IDirectSound3DBuffer::SetPosition().
GTA San Andreas calls this function with NaN positions under certain
circumstances which eventually results in dwTotalAmpFactor value
being really high (and causing extremely loud audio output).
2024-08-15 20:18:16 +03:00
2 changed files with 14 additions and 0 deletions

View file

@ -703,6 +703,9 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_SetPosition(IDirectSound3DBuffer
TRACE("setting: Position vector = (%f,%f,%f); dwApply = %ld\n", x, y, z, dwApply);
if (isnan(x) || isnan(y) || isnan(z))
return DSERR_INVALIDPARAM;
AcquireSRWLockExclusive(&This->lock);
This->ds3db_ds3db.vPosition.x = x;
@ -961,6 +964,11 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_SetOrientation(IDirectSound3DLi
TRACE("setting: Front vector = (%f,%f,%f); Top vector = (%f,%f,%f); dwApply = %ld\n",
xFront, yFront, zFront, xTop, yTop, zTop, dwApply);
if (isnan(xFront) || isnan(yFront) || isnan(zFront)
|| isnan(xTop) || isnan(yTop) || isnan(zTop))
return DSERR_INVALIDPARAM;
This->device->ds3dl.vOrientFront.x = xFront;
This->device->ds3dl.vOrientFront.y = yFront;
This->device->ds3dl.vOrientFront.z = zFront;

View file

@ -669,6 +669,10 @@ void test_buffer(LPDIRECTSOUND dso, LPDIRECTSOUNDBUFFER *dsbo,
buffer_param.vPosition.x,buffer_param.vPosition.y,
buffer_param.vPosition.z,DS3D_IMMEDIATE);
ok(rc==DS_OK,"IDirectSound3dBuffer_SetPosition() failed: %08lx\n", rc);
rc=IDirectSound3DBuffer_SetPosition(buffer,
NAN,NAN,NAN,DS3D_IMMEDIATE);
ok(rc==DSERR_INVALIDPARAM,"IDirectSound3dBuffer_SetPosition() returned %08lx\n", rc);
}
}
/* Check the sound duration was within 10% of the expected value */
@ -1350,6 +1354,8 @@ static void check_doppler(IDirectSound *dsound, IDirectSound3DListener *listener
ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDirectSound3DListener_SetVelocity(listener, 0, 0, 0, DS3D_DEFERRED);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDirectSound3DListener_SetOrientation(listener, NAN, NAN, NAN, NAN, NAN, NAN, DS3D_DEFERRED);
ok(hr == DSERR_INVALIDPARAM, "Got hr %#lx.\n", hr);
hr = IDirectSound3DBuffer_SetPosition(buffer_3d, 0, 1, 0, DS3D_DEFERRED);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
hr = IDirectSound3DBuffer_SetVelocity(buffer_3d, 0, -60, 0, DS3D_DEFERRED);