Fix crash in GameSave::serialiseOPS
Only particlesCount particles have been copied from the Simulation. All the rest are uninitialised, and may have coordinates outside the game area. Using those uninitialised coordinates in the index for partsPosFirstMap may cause a crash.
This commit is contained in:
parent
d29c77b2d5
commit
9c6f3c7fbb
@ -1701,7 +1701,7 @@ char * GameSave::serialiseOPS(int & dataLength)
|
||||
partsPosLastMap = (unsigned int *)calloc(fullW*fullH, sizeof(unsigned));
|
||||
partsPosCount = (unsigned int *)calloc(fullW*fullH, sizeof(unsigned));
|
||||
partsPosLink = (unsigned int *)calloc(NPART, sizeof(unsigned));
|
||||
for(i = 0; i < NPART; i++)
|
||||
for(i = 0; i < particlesCount; i++)
|
||||
{
|
||||
if(particles[i].type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user