summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2015-01-25 18:18:49 +0100
committerPierre Bourdon <delroth@gmail.com>2015-01-25 18:18:49 +0100
commita93433a860af23ca862fe3f1f0e58d1ea6dfd9d4 (patch)
treebd58ae03674e565a8d0d6958d9621a7b592a1667 /Source/Core/VideoCommon
parent0aef1d27aa03e79e2cecb96a3bbf540f3ddb4aa0 (diff)
parent61215e718028de2d4b0e302f2226e43d0051876f (diff)
Merge pull request #1960 from phire/zfreeze-buffer-underrun
Fix a buffer underrun in CalculateZSlope.
Diffstat (limited to 'Source/Core/VideoCommon')
-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.