From 160b684d5ada8279183bc7223d3779e6aef57d99 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 13 Sep 2019 11:49:00 +0200 Subject: [PATCH] [d3d11] Add range check for scissors and make failing it unlikely --- src/d3d11/d3d11_context.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 5d7f42763..e5d94802f 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -2843,7 +2843,7 @@ namespace dxvk { const D3D11_VIEWPORT* pViewports) { D3D10DeviceLock lock = LockContext(); - if (NumViewports > m_state.rs.viewports.size()) + if (unlikely(NumViewports > m_state.rs.viewports.size())) return; bool dirty = m_state.rs.numViewports != NumViewports; @@ -2871,6 +2871,9 @@ namespace dxvk { UINT NumRects, const D3D11_RECT* pRects) { D3D10DeviceLock lock = LockContext(); + + if (unlikely(NumRects > m_state.rs.scissors.size())) + return; bool dirty = m_state.rs.numScissors != NumRects; m_state.rs.numScissors = NumRects;