[PATCH 1/4] d3dx9_36: Add casts in RECT vs surface size checks.
Stefan Dösinger
stefan at codeweavers.com
Tue Feb 18 03:46:13 CST 2014
In both cases we have an explicit check that tests the singed values for
negative numbers.
---
dlls/d3dx9_36/surface.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c
index 71c43bd..511bf6b 100644
--- a/dlls/d3dx9_36/surface.c
+++ b/dlls/d3dx9_36/surface.c
@@ -1752,8 +1752,8 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
}
else
{
- if (dst_rect->left > dst_rect->right || dst_rect->right > surfdesc.Width
- || dst_rect->top > dst_rect->bottom || dst_rect->bottom > surfdesc.Height
+ if (dst_rect->left > dst_rect->right || (UINT)dst_rect->right > surfdesc.Width
+ || dst_rect->top > dst_rect->bottom || (UINT)dst_rect->bottom > surfdesc.Height
|| dst_rect->left < 0 || dst_rect->top < 0)
{
WARN("Invalid dst_rect specified.\n");
@@ -2008,7 +2008,8 @@ HRESULT WINAPI D3DXSaveSurfaceToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
return D3DERR_INVALIDCALL;
if (src_rect->left > src_rect->right || src_rect->top > src_rect->bottom)
return D3DERR_INVALIDCALL;
- if (src_rect->right > src_surface_desc.Width || src_rect->bottom > src_surface_desc.Height)
+ if ((UINT)src_rect->right > src_surface_desc.Width
+ || (UINT)src_rect->bottom > src_surface_desc.Height)
return D3DERR_INVALIDCALL;
width = src_rect->right - src_rect->left;
--
1.8.3.2
More information about the wine-patches
mailing list