Mercurial > mm7
changeset 2436:ed1e4cff79a2
fixed uninitialized memory access in SpriteFrameTable::FromFile
author | Grumpy7 |
---|---|
date | Wed, 23 Jul 2014 22:24:53 +0200 |
parents | 9f30d514cdd2 |
children | ea7748f4dc60 |
files | Sprites.cpp |
diffstat | 1 files changed, 3 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/Sprites.cpp Wed Jul 23 19:52:49 2014 +0100 +++ b/Sprites.cpp Wed Jul 23 22:24:53 2014 +0200 @@ -406,17 +406,9 @@ memcpy(pSpriteSFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8, mm8_frames_size); memcpy(pSpriteEFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8 + mm8_frames_size, 2 * num_mm8_eframes); - for (uint i = 0; i < num_mm7_frames; ++i) - pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]];//Uninitialized memory access - - for (uint i = num_mm7_frames; i < num_mm6_frames + num_mm7_frames; ++i) - pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm7_frames]; - - for (uint i = num_mm6_frames + num_mm7_frames; i < num_mm6_frames + num_mm7_frames + num_mm8_frames; ++i) - pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm6_frames + num_mm7_frames]; - - //for (uint i = 0; i < uNumSpriteFrames; ++i) - // pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]]; + //the original was using num_mmx_frames, but never accessed any element beyond num_mmx_eframes, but boing beyong eframes caused invalid memory accesses + for (uint i = 0; i < num_mm6_eframes + num_mm7_eframes + num_mm8_eframes; ++i) + pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]]; } //----- (0044DA92) --------------------------------------------------------