Be more stringent in the 'Lock' invalid RECT check.

This commit is contained in:
Lionel Ulmer 2003-06-13 16:31:41 +00:00 committed by Alexandre Julliard
parent 9ac8ba1589
commit 8944b25ead
1 changed files with 10 additions and 2 deletions

View File

@ -1016,11 +1016,19 @@ Main_DirectDrawSurface_Lock(LPDIRECTDRAWSURFACE7 iface, LPRECT prect,
if (prect != NULL) {
TRACE(" lprect: %ldx%ld-%ldx%ld\n",
prect->top,prect->left,prect->bottom,prect->right);
/* First do some sanity checkings on the rectangle we receive.
DungeonSiege seems to gives us once a very bad rectangle for example */
if ((prect->top < 0) ||
(prect->left < 0) ||
(prect->bottom < 0) ||
(prect->right < 0)) {
ERR(" Negative values in LPRECT !!!\n");
(prect->right < 0) ||
(prect->left >= prect->right) ||
(prect->top >= prect->bottom) ||
(prect->left >= This->surface_desc.dwWidth) ||
(prect->right > This->surface_desc.dwWidth) ||
(prect->top >= This->surface_desc.dwHeight) ||
(prect->bottom > This->surface_desc.dwHeight)) {
ERR(" Invalid values in LPRECT !!!\n");
return DDERR_INVALIDPARAMS;
}