mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 05:52:11 +01:00
[d3d8] Validate srcRect/destPoint dimensions in UpdateTextureFromBuffer
This commit is contained in:
parent
736ee20eb5
commit
4184452f49
@ -45,6 +45,26 @@ namespace dxvk {
|
||||
if (unlikely(dst == nullptr || src == nullptr))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// CopyRects will not pass a null pSrcRect, but check anyway
|
||||
if (unlikely(pSrcRect == nullptr))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// validate dimensions to ensure we calculate a meaningful srcOffset & extent
|
||||
if (unlikely(pSrcRect->left < 0
|
||||
|| pSrcRect->top < 0
|
||||
|| pSrcRect->right <= pSrcRect->left
|
||||
|| pSrcRect->bottom <= pSrcRect->top))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// CopyRects will not pass a null pDestPoint, but check anyway
|
||||
if (unlikely(pDestPoint == nullptr))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
// validate dimensions to ensure we caculate a meaningful dstOffset
|
||||
if (unlikely(pDestPoint->x < 0
|
||||
|| pDestPoint->y < 0))
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
||||
D3D9CommonTexture* srcTextureInfo = src->GetCommonTexture();
|
||||
D3D9CommonTexture* dstTextureInfo = dst->GetCommonTexture();
|
||||
|
||||
@ -59,13 +79,10 @@ namespace dxvk {
|
||||
|
||||
extent = { uint32_t(pSrcRect->right - pSrcRect->left), uint32_t(pSrcRect->bottom - pSrcRect->top), 1 };
|
||||
|
||||
// TODO: Validate extents like in D3D9DeviceEx::UpdateSurface
|
||||
|
||||
dstOffset = { pDestPoint->x,
|
||||
pDestPoint->y,
|
||||
0u };
|
||||
|
||||
|
||||
m_device->UpdateTextureFromBuffer(
|
||||
srcTextureInfo, dstTextureInfo,
|
||||
src->GetSubresource(), dst->GetSubresource(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user