Commit aff1dbe5 authored by Jeff Zaroyko's avatar Jeff Zaroyko Committed by Alexandre Julliard

dsound: Check for invalid parameter when locking primary and secondary buffers.

parent 14db7003
...@@ -532,6 +532,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock( ...@@ -532,6 +532,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Lock(
GetTickCount() GetTickCount()
); );
if (!audiobytes1)
return DSERR_INVALIDPARAM;
/* when this flag is set, writecursor is meaningless and must be calculated */ /* when this flag is set, writecursor is meaningless and must be calculated */
if (flags & DSBLOCK_FROMWRITECURSOR) { if (flags & DSBLOCK_FROMWRITECURSOR) {
/* GetCurrentPosition does too much magic to duplicate here */ /* GetCurrentPosition does too much magic to duplicate here */
......
...@@ -837,6 +837,9 @@ static HRESULT WINAPI PrimaryBufferImpl_Lock( ...@@ -837,6 +837,9 @@ static HRESULT WINAPI PrimaryBufferImpl_Lock(
GetTickCount() GetTickCount()
); );
if (!audiobytes1)
return DSERR_INVALIDPARAM;
if (device->priolevel != DSSCL_WRITEPRIMARY) { if (device->priolevel != DSSCL_WRITEPRIMARY) {
WARN("failed priority check!\n"); WARN("failed priority check!\n");
return DSERR_PRIOLEVELNEEDED; return DSERR_PRIOLEVELNEEDED;
......
...@@ -184,6 +184,10 @@ static int buffer_refill(play_state_t* state, DWORD size) ...@@ -184,6 +184,10 @@ static int buffer_refill(play_state_t* state, DWORD size)
if (size>state->wave_len-state->written) if (size>state->wave_len-state->written)
size=state->wave_len-state->written; size=state->wave_len-state->written;
/* some broken apps like Navyfield mistakenly pass NULL for a ppValue */
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,NULL,&ptr2,&len2,0);
ok(rc==DSERR_INVALIDPARAM,"expected %08x got %08x\n",DSERR_INVALIDPARAM, rc);
rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size, rc=IDirectSoundBuffer_Lock(state->dsbo,state->offset,size,
&ptr1,&len1,&ptr2,&len2,0); &ptr1,&len1,&ptr2,&len2,0);
ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %08x\n", rc); ok(rc==DS_OK,"IDirectSoundBuffer_Lock() failed: %08x\n", rc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment