Henri Verbeet : ddraw: Validate the surface pitch for user memory surfaces in ddraw_surface_init ().

Alexandre Julliard julliard at winehq.org
Tue Mar 4 14:08:51 CST 2014


Module: wine
Branch: master
Commit: 9c138d772c692d44103a6641c32f3b74dc83303e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9c138d772c692d44103a6641c32f3b74dc83303e

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Mar  4 10:21:37 2014 +0100

ddraw: Validate the surface pitch for user memory surfaces in ddraw_surface_init().

---

 dlls/ddraw/surface.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c
index 8cfba29..4a1b112 100644
--- a/dlls/ddraw/surface.c
+++ b/dlls/ddraw/surface.c
@@ -6067,6 +6067,12 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, s
 
     if (desc->dwFlags & DDSD_LPSURFACE)
     {
+        if (desc->u1.lPitch < wined3d_surface_get_pitch(wined3d_surface) || desc->u1.lPitch & 3)
+        {
+            WARN("Invalid pitch %u specified.\n", desc->u1.lPitch);
+            return DDERR_INVALIDPARAMS;
+        }
+
         if (FAILED(hr = wined3d_surface_update_desc(wined3d_surface, wined3d_desc.width,
                 wined3d_desc.height, wined3d_desc.format, WINED3D_MULTISAMPLE_NONE, 0,
                 desc->lpSurface, desc->u1.lPitch)))




More information about the wine-cvs mailing list