mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-30 11:19:51 +02:00
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:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user