diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-20 05:57:47 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-20 05:57:47 +0000 |
commit | 3786527e6b7b9c506ea7142e4bbdf564d4c685c3 (patch) | |
tree | a286fd9512776e7396e096e177136561fbffc0ff /spritecache.c | |
parent | ccdf3227990ba90ace9dd725becb3761ee66f6c9 (diff) | |
download | openttd-3786527e6b7b9c506ea7142e4bbdf564d4c685c3.tar.xz |
(svn r4481) - Fix: Validate the given sprite ID when loading a sprite.
Diffstat (limited to 'spritecache.c')
-rw-r--r-- | spritecache.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spritecache.c b/spritecache.c index 555304f77..8e99a34f4 100644 --- a/spritecache.c +++ b/spritecache.c @@ -149,6 +149,10 @@ bool LoadNextSprite(int load_index, byte file_index) if (!ReadSpriteHeaderSkipData()) return false; + if (load_index >= MAX_SPRITES) { + error("Tried to load too many sprites (#%d; max %d)", load_index, MAX_SPRITES); + } + _sprite_file_pos[load_index] = file_pos; _sprite_ptr[load_index] = NULL; |