From 8944b25ead0010ab81606e79aeeff75c20b9bca7 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer <lionel.ulmer@free.fr> Date: Fri, 13 Jun 2003 16:31:41 +0000 Subject: [PATCH] Be more stringent in the 'Lock' invalid RECT check. --- dlls/ddraw/dsurface/main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/dsurface/main.c b/dlls/ddraw/dsurface/main.c index 9ae9ba13e8d..c62d1c35e21 100644 --- a/dlls/ddraw/dsurface/main.c +++ b/dlls/ddraw/dsurface/main.c @@ -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; } -- GitLab