diff options
| author | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-12-16 22:56:03 (GMT) |
|---|---|---|
| committer | jacksonmj <mj-pt@jacksonmj.co.uk> | 2012-12-16 23:01:04 (GMT) |
| commit | 9c6f3c7fbb45d458169769b48154277e9e49ff60 (patch) | |
| tree | 079ab021eefe841cd07aff2ab512c47a367cfa39 /src | |
| parent | d29c77b2d5d9a03f64d35b7ef8727c7624e9cc99 (diff) | |
| download | powder-9c6f3c7fbb45d458169769b48154277e9e49ff60.zip powder-9c6f3c7fbb45d458169769b48154277e9e49ff60.tar.gz | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/GameSave.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/client/GameSave.cpp b/src/client/GameSave.cpp index fbb9829..8da60c8 100644 --- a/src/client/GameSave.cpp +++ b/src/client/GameSave.cpp @@ -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) { |
