st/nine: Prevent crash in GetRenderTargetData
authorPatrick Rudolph <siro@das-labor.org>
Wed, 28 Sep 2016 16:50:19 +0000 (18:50 +0200)
committerAxel Davy <axel.davy@ens.fr>
Mon, 10 Oct 2016 21:43:51 +0000 (23:43 +0200)
Return error instead of crashing on source surfaces
with format D3DFMT_NULL.

Fix for issue #236.

Tested on Windows 7.

Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/device9.c

index 47fd3a48b55ad9d9db68fb03e585d6c197b0df60..b094edeb87d948b2b9bdfea80388da1b66caf4b5 100644 (file)
@@ -1464,6 +1464,8 @@ NineDevice9_GetRenderTargetData( struct NineDevice9 *This,
     user_assert(src->desc.Width == dst->desc.Width, D3DERR_INVALIDCALL);
     user_assert(src->desc.Height == dst->desc.Height, D3DERR_INVALIDCALL);
 
+    user_assert(src->desc.Format != D3DFMT_NULL, D3DERR_INVALIDCALL);
+
     NineSurface9_CopyDefaultToMem(dst, src);
 
     return D3D_OK;