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
committerPhilip Rebohle <philip.rebohle@tu-dortmund.de>2023-11-14 14:21:26 +0300
commitd5a1d64b4283fc34b22c84ebf4eb6a683471ff0d (patch)
treef0405ceeb5e20bb2fd48edbf1eceed35a4bbea7f
parent2ed1778df9ea5d81fff22f76f125b08995454847 (diff)
[d3d9] Return empty buffer slice for out-of-bounds offsetsd3d9-buffer-slice-range
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() {