[PATCH 2/2] ddraw/tests: Check pointer after CreateSurface with a bad descriptor.

Alex Henrie alexhenrie24 at gmail.com
Fri Feb 17 00:05:13 CST 2017


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ddraw/tests/dsurface.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c
index 73e272c663..3713cf9ec2 100644
--- a/dlls/ddraw/tests/dsurface.c
+++ b/dlls/ddraw/tests/dsurface.c
@@ -2414,6 +2414,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     ok(SUCCEEDED(hr), "IDirectDraw_CreateSurface failed: 0x%08x\n", hr);
     IDirectDrawSurface_Release(surf);
 
+    surf = (IDirectDrawSurface *)0xdeadbeef;
     hr = IDirectDraw_CreateSurface(lpDD, &ddsd_bad1, &surf, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
@@ -2429,6 +2430,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     hr = IDirectDraw_CreateSurface(lpDD, NULL, &surf, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
+    ok(surf == (IDirectDrawSurface *)0xdeadbeef, "Got unexpected surface %p\n", surf);
 
     hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, (void **) &dd2);
     ok(SUCCEEDED(hr), "IDirectDraw_QueryInterface failed: 0x%08x\n", hr);
@@ -2437,6 +2439,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     ok(SUCCEEDED(hr), "IDirectDraw2_CreateSurface failed: 0x%08x\n", hr);
     IDirectDrawSurface_Release(surf);
 
+    surf = (IDirectDrawSurface *)0xdeadbeef;
     hr = IDirectDraw2_CreateSurface(dd2, &ddsd_bad1, &surf, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
@@ -2452,6 +2455,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     hr = IDirectDraw2_CreateSurface(dd2, NULL, &surf, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw2_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
+    ok(surf == (IDirectDrawSurface *)0xdeadbeef, "Got unexpected surface %p\n", surf);
 
     IDirectDraw2_Release(dd2);
 
@@ -2462,6 +2466,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     ok(SUCCEEDED(hr), "IDirectDraw4_CreateSurface failed: 0x%08x\n", hr);
     IDirectDrawSurface4_Release(surf4);
 
+    surf4 = (IDirectDrawSurface4 *)0xdeadbeef;
     hr = IDirectDraw4_CreateSurface(dd4, &ddsd2_bad1, &surf4, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
@@ -2477,6 +2482,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     hr = IDirectDraw4_CreateSurface(dd4, NULL, &surf4, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw4_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
+    ok(surf4 == (IDirectDrawSurface4 *)0xdeadbeef, "Got unexpected surface %p\n", surf4);
 
     IDirectDraw4_Release(dd4);
 
@@ -2487,6 +2493,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     ok(SUCCEEDED(hr), "IDirectDraw7_CreateSurface failed: 0x%08x\n", hr);
     IDirectDrawSurface7_Release(surf7);
 
+    surf7 = (IDirectDrawSurface7 *)0xdeadbeef;
     hr = IDirectDraw7_CreateSurface(dd7, &ddsd2_bad1, &surf7, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
@@ -2502,6 +2509,7 @@ static void CreateSurfaceBadCapsSizeTest(void)
     hr = IDirectDraw7_CreateSurface(dd7, NULL, &surf7, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "IDirectDraw7_CreateSurface didn't return 0x%08x, but 0x%08x\n",
        DDERR_INVALIDPARAMS, hr);
+    ok(surf7 == (IDirectDrawSurface7 *)0xdeadbeef, "Got unexpected surface %p\n", surf7);
 
     IDirectDraw7_Release(dd7);
 }
-- 
2.11.1




More information about the wine-patches mailing list