From df65a57e1238d6aa5abc2ca40413bfc511553696 Mon Sep 17 00:00:00 2001 From: Jeff Zaroyko Date: Fri, 2 Jan 2009 17:03:00 +1100 Subject: dsound: check for invalid parameter when unlocking primary buffers --- dlls/dsound/primary.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index 5812f00..b368bb9 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -1000,7 +1000,11 @@ 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 (x1 + (DWORD_PTR)p1 - (DWORD_PTR)device->buffer > 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; -- 1.5.4.3