mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-06 22:37:22 +00:00
(svn r8166) -Fix (r7797): Protect against out of bounds access to the sprite ptr
list.
This commit is contained in:
parent
0c9e65d8cc
commit
f19b87df08
@ -107,7 +107,7 @@ bool SpriteExists(SpriteID id)
|
||||
{
|
||||
/* Special case for Sprite ID zero -- its position is also 0... */
|
||||
if (id == 0) return true;
|
||||
|
||||
if (id >= _spritecache_items) return false;
|
||||
return GetSpriteCache(id)->file_pos != 0;
|
||||
}
|
||||
|
||||
@ -386,7 +386,7 @@ const void *GetRawSprite(SpriteID sprite)
|
||||
SpriteCache *sc;
|
||||
void* p;
|
||||
|
||||
assert(sprite < MAX_SPRITES);
|
||||
assert(sprite < _spritecache_items);
|
||||
|
||||
sc = GetSpriteCache(sprite);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user