dsound: Check for invalid parameter when unlocking primary buffers.

This commit is contained in:
Jeff Zaroyko 2009-01-02 17:03:00 +11:00 committed by Alexandre Julliard
parent 73393fab16
commit 14db70036d

View File

@ -999,8 +999,12 @@ static HRESULT WINAPI PrimaryBufferImpl_Unlock(
if (!(device->drvdesc.dwFlags & DSDDESC_DONTNEEDPRIMARYLOCK) && device->hwbuf) {
HRESULT hres;
hres = IDsDriverBuffer_Unlock(device->hwbuf, p1, x1, p2, x2);
if ((char *)p1 - (char *)device->buffer + x1 > device->buflen)
hres = DSERR_INVALIDPARAM;
else
hres = IDsDriverBuffer_Unlock(device->hwbuf, p1, x1, p2, x2);
if (hres != DS_OK) {
WARN("IDsDriverBuffer_Unlock failed\n");
return hres;