Fix invalid memory access bug

This commit is contained in:
Luke Benstead 2018-09-06 19:46:04 +01:00
parent b4539443f5
commit d9fa69c288

View File

@ -780,6 +780,7 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
/* Make room in the list buffer */
GLsizei spaceNeeded = (mode == GL_POLYGON || mode == GL_TRIANGLE_FAN) ? ((count - 2) * 3) : count;
ClipVertex* start = aligned_vector_extend(&activeList->vector, spaceNeeded + 1);
uint32_t startOffset = start - (ClipVertex*) activeList->vector.data;
/* Store a pointer to the header for later */
PVRHeader* header = (PVRHeader*) start++;
@ -828,11 +829,15 @@ static void submitVertices(GLenum mode, GLsizei first, GLsizei count, GLenum typ
fprintf(stderr, "%x\n", *((uint32_t*)v));
}
}
*/
#endif
}
profiler_checkpoint("clip");
/* Clipping may have realloc'd so reset the start pointer */
start = ((ClipVertex*) activeList->vector.data) + startOffset;
divide(start, spaceNeeded);
profiler_checkpoint("divide");