summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexManagerBase.cpp
diff options
context:
space:
mode:
authorScott Mansell <phiren@gmail.com>2015-01-25 20:31:20 +1300
committerScott Mansell <phiren@gmail.com>2015-01-25 20:31:20 +1300
commit61215e718028de2d4b0e302f2226e43d0051876f (patch)
tree14c9ed5f1642951535da6efd27271b023db36d43 /Source/Core/VideoCommon/VertexManagerBase.cpp
parentbf0293231f4f87f1678cc4033dada67413e505b4 (diff)
Fix a buffer underrun in CalculateZSlope.
Diffstat (limited to 'Source/Core/VideoCommon/VertexManagerBase.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexManagerBase.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp
index e34af09bfc..2ebb42122f 100644
--- a/Source/Core/VideoCommon/VertexManagerBase.cpp
+++ b/Source/Core/VideoCommon/VertexManagerBase.cpp
@@ -287,6 +287,10 @@ void VertexManager::CalculateZSlope(NativeVertexFormat* format)
size_t posOff = vert_decl.position.offset;
size_t mtxOff = vert_decl.posmtx.offset;
+ // Make sure the buffer contains at lest 3 vertices.
+ if ((s_pCurBufferPointer - s_pBaseBufferPointer) < (vert_decl.stride * 3))
+ return;
+
// Lookup vertices of the last rendered triangle and software-transform them
// This allows us to determine the depth slope, which will be used if z--freeze
// is enabled in the following flush.