Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-11-14 14:17:39 +0300
committerJoshie <joshua@froggi.es>2023-11-14 21:54:54 +0300
commitea3149801f94e219163d91b0ab233340b0acec12 (patch)
treefdea8878137d6a033828b5f97a9344fed3b00790
parent1cb58b0732d96976c4a0a9e268ce55253dd51a8d (diff)
[d3d9] Return empty buffer slice for out-of-bounds offsets
Fixes #3715.
-rw-r--r--src/d3d9/d3d9_common_buffer.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/d3d9/d3d9_common_buffer.h b/src/d3d9/d3d9_common_buffer.h
index 782be427..74596198 100644
--- a/src/d3d9/d3d9_common_buffer.h
+++ b/src/d3d9/d3d9_common_buffer.h
@@ -125,7 +125,12 @@ namespace dxvk {
template <D3D9_COMMON_BUFFER_TYPE Type>
inline DxvkBufferSlice GetBufferSlice(VkDeviceSize offset, VkDeviceSize length) const {
- return DxvkBufferSlice(GetBuffer<Type>(), offset, length);
+ if (likely(length && offset < m_desc.Size)) {
+ return DxvkBufferSlice(GetBuffer<Type>(), offset,
+ std::min<VkDeviceSize>(m_desc.Size - offset, length));
+ }
+
+ return DxvkBufferSlice();
}
inline DxvkBufferSliceHandle AllocMapSlice() {