From 643e6379a955b875447fd8c245ab47fd8af1f216 Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Mon, 8 Jul 2019 10:19:45 -0500 Subject: [PATCH] d3drm: Return error if setting viewport field-of-view to zero or negative value. Signed-off-by: Jeff Smith Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3drm/tests/d3drm.c | 8 ++++++++ dlls/d3drm/viewport.c | 3 +++ 2 files changed, 11 insertions(+) diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 88f3db819df..dbba859215b 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2157,6 +2157,10 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); hr = IDirect3DRMViewport_GetDirect3DViewport(viewport, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport_SetField(viewport, 0.0f); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport_SetField(viewport, -1.0f); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); IDirect3DRMViewport_Release(viewport); ref4 = get_refcount((IUnknown *)d3drm1); @@ -2249,6 +2253,10 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); hr = IDirect3DRMViewport2_GetDirect3DViewport(viewport2, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport2_SetField(viewport2, 0.0f); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport2_SetField(viewport2, -1.0f); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); IDirect3DRMViewport2_Release(viewport2); ref4 = get_refcount((IUnknown *)d3drm1); diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index 430c9d470bf..c2fa1897420 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -523,6 +523,9 @@ static HRESULT WINAPI d3drm_viewport2_SetField(IDirect3DRMViewport2 *iface, D3DV TRACE("iface %p, field %.8e.\n", iface, field); + if (field <= 0.0f) + return D3DRMERR_BADVALUE; + viewport->field = field; return D3DRM_OK;