Browse Source

[cocos2dx] Segfault when copying old scratch buffer contents to resized buffer. Closes #1295.

badlogic 6 years ago
parent
commit
2eb85acff9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      spine-cocos2dx/src/spine/SkeletonRenderer.cpp

+ 1 - 1
spine-cocos2dx/src/spine/SkeletonRenderer.cpp

@@ -44,7 +44,7 @@ static size_t worldVerticesLength = 0;
 void ensureWorldVerticesCapacity(size_t capacity) {
 void ensureWorldVerticesCapacity(size_t capacity) {
 	if (worldVerticesLength < capacity) {
 	if (worldVerticesLength < capacity) {
 		float* newWorldVertices = new float[capacity];
 		float* newWorldVertices = new float[capacity];
-		memcpy(newWorldVertices, worldVertices, capacity * sizeof(float));
+		memcpy(newWorldVertices, worldVertices, worldVerticesLength * sizeof(float));
 		delete[] worldVertices;
 		delete[] worldVertices;
 		worldVertices = newWorldVertices;
 		worldVertices = newWorldVertices;
 		worldVerticesLength = capacity;
 		worldVerticesLength = capacity;