mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Validate subresource index in MapImage
Fixes crashes when passing an invalid subresource index.
This commit is contained in:
parent
3168626f4b
commit
754cf6da30
@ -214,6 +214,9 @@ namespace dxvk {
|
|||||||
Logger::err("D3D11: Cannot map a device-local image");
|
Logger::err("D3D11: Cannot map a device-local image");
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlikely(Subresource >= pTexture->CountSubresources()))
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
VkFormat packedFormat = m_parent->LookupPackedFormat(
|
VkFormat packedFormat = m_parent->LookupPackedFormat(
|
||||||
pTexture->Desc()->Format, pTexture->GetFormatMode()).Format;
|
pTexture->Desc()->Format, pTexture->GetFormatMode()).Format;
|
||||||
|
@ -339,6 +339,9 @@ namespace dxvk {
|
|||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlikely(Subresource >= pResource->CountSubresources()))
|
||||||
|
return E_INVALIDARG;
|
||||||
|
|
||||||
pResource->SetMapType(Subresource, MapType);
|
pResource->SetMapType(Subresource, MapType);
|
||||||
|
|
||||||
VkFormat packedFormat = m_parent->LookupPackedFormat(
|
VkFormat packedFormat = m_parent->LookupPackedFormat(
|
||||||
|
@ -74,6 +74,14 @@ namespace dxvk {
|
|||||||
const D3D11_COMMON_TEXTURE_DESC* Desc() const {
|
const D3D11_COMMON_TEXTURE_DESC* Desc() const {
|
||||||
return &m_desc;
|
return &m_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Counts number of subresources
|
||||||
|
* \returns Number of subresources
|
||||||
|
*/
|
||||||
|
UINT CountSubresources() const {
|
||||||
|
return m_desc.ArraySize * m_desc.MipLevels;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Map mode
|
* \brief Map mode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user