From: Pierre Schweitzer Subject: [PATCH] dsound: do not allow adding a NULL ptr as buffer in DirectSoundDevice_AddBuffer() Message-Id: <549AC5C0.5070701@reactos.org> Date: Wed, 24 Dec 2014 14:55:12 +0100 Dear all, Please find attach a patch which prevents DirectSoundDevice_AddBuffer() from accepting NULL pointers. It results from a bugfix & testing here. While trying to start Steam Lego Star Wars, I was experiencing an invalid address dereference in DSOUND_ChangeListener() (line 312). Adding this check makes the game work properly (with sound). I tested it. Cheers, -- Pierre Schweitzer System & Network Administrator Senior Kernel Developer ReactOS Deutschland e.V. From 2ebe401a4bbb988ee8e708af0b42425c1a642010 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Wed, 24 Dec 2014 14:48:13 +0100 Subject: [PATCH] dsound: do not allow adding a NULL ptr as buffer in DirectSoundDevice_AddBuffer(). These buffers are then dereferenced without any prior in functions such as DSOUND_ChangeListener(). This was causing segfault (and thus making app crash). --- dlls/dsound/dsound.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c index 986168b..fe4a658 100644 --- a/dlls/dsound/dsound.c +++ b/dlls/dsound/dsound.c @@ -1050,6 +1050,9 @@ HRESULT DirectSoundDevice_AddBuffer( TRACE("(%p, %p)\n", device, pDSB); + if (pDSB == NULL) + return DSERR_INVALIDPARAM; + RtlAcquireResourceExclusive(&(device->buffer_list_lock), TRUE); if (device->buffers) -- 1.9.1