Jeff Zaroyko : dsound: Check for invalid parameter when unlocking primary buffers.
Alexandre Julliard
julliard at winehq.org
Fri Jan 2 08:25:50 CST 2009
Module: wine
Branch: master
Commit: 14db70036d37285fb751f829b609e2e74b56ba66
URL: http://source.winehq.org/git/wine.git/?a=commit;h=14db70036d37285fb751f829b609e2e74b56ba66
Author: Jeff Zaroyko <jeffz at jeffz.name>
Date: Fri Jan 2 17:03:00 2009 +1100
dsound: Check for invalid parameter when unlocking primary buffers.
---
dlls/dsound/primary.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index 5812f00..f0ba854 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -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;
More information about the wine-cvs
mailing list