(svn r8166) -Fix (r7797): Protect against out of bounds access to the sprite ptr

list.
This commit is contained in:
peter1138 2007-01-16 22:10:35 +00:00
parent 7479eab247
commit e6178acc18

View File

@ -107,7 +107,7 @@ bool SpriteExists(SpriteID id)
{ {
/* Special case for Sprite ID zero -- its position is also 0... */ /* Special case for Sprite ID zero -- its position is also 0... */
if (id == 0) return true; if (id == 0) return true;
if (id >= _spritecache_items) return false;
return GetSpriteCache(id)->file_pos != 0; return GetSpriteCache(id)->file_pos != 0;
} }
@ -386,7 +386,7 @@ const void *GetRawSprite(SpriteID sprite)
SpriteCache *sc; SpriteCache *sc;
void* p; void* p;
assert(sprite < MAX_SPRITES); assert(sprite < _spritecache_items);
sc = GetSpriteCache(sprite); sc = GetSpriteCache(sprite);