mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r8166) -Fix (r7797): Protect against out of bounds access to the sprite ptr
list.
This commit is contained in:
parent
7479eab247
commit
e6178acc18
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user