mirror of
https://github.com/reactos/reactos.git
synced 2024-08-02 17:40:58 +00:00
Fixing another memory crash bug this time for GetFourCCCodes
svn path=/trunk/; revision=26864
This commit is contained in:
parent
2a62b56fd9
commit
3355adf732
|
@ -11,6 +11,9 @@
|
|||
|
||||
#include "rosdraw.h"
|
||||
|
||||
/* PSEH for SEH Support */
|
||||
#include <pseh/pseh.h>
|
||||
|
||||
HRESULT WINAPI
|
||||
Main_DirectDraw_QueryInterface (LPDIRECTDRAW7 iface,
|
||||
REFIID id,
|
||||
|
@ -150,16 +153,18 @@ Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD lpNumCodes, LPDWORD
|
|||
|
||||
DX_WINDBG_trace();
|
||||
|
||||
/* FIXME protect with SEH or something else if lpCodes or lpNumCodes for bad user pointers */
|
||||
EnterCriticalSection(&ddcs);
|
||||
|
||||
if(!lpNumCodes)
|
||||
// EnterCriticalSection(&ddcs);
|
||||
|
||||
_SEH_TRY
|
||||
{
|
||||
if(IsBadWritePtr(lpNumCodes,sizeof(LPDWORD)))
|
||||
{
|
||||
retVal = DDERR_INVALIDPARAMS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((lpCodes) && (*lpCodes))
|
||||
if(!IsBadWritePtr(lpCodes,sizeof(LPDWORD)))
|
||||
{
|
||||
memcpy(lpCodes, This->lpLcl->lpGbl->lpdwFourCC, sizeof(DWORD)* min(This->lpLcl->lpGbl->dwNumFourCC, *lpNumCodes));
|
||||
}
|
||||
|
@ -168,8 +173,13 @@ Main_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD lpNumCodes, LPDWORD
|
|||
*lpNumCodes = This->lpLcl->lpGbl->dwNumFourCC;
|
||||
}
|
||||
}
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
}
|
||||
_SEH_END;
|
||||
|
||||
LeaveCriticalSection(&ddcs);
|
||||
//LeaveCriticalSection(&ddcs);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<library>user32</library>
|
||||
<library>advapi32</library>
|
||||
<library>msvcrt</library>
|
||||
<library>pseh</library>
|
||||
|
||||
<file>ddraw.rc</file>
|
||||
<file>main.c</file>
|
||||
|
|
Loading…
Reference in a new issue