summaryrefslogtreecommitdiff
path: root/spritecache.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-20 05:57:47 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-20 05:57:47 +0000
commit3786527e6b7b9c506ea7142e4bbdf564d4c685c3 (patch)
treea286fd9512776e7396e096e177136561fbffc0ff /spritecache.c
parentccdf3227990ba90ace9dd725becb3761ee66f6c9 (diff)
downloadopenttd-3786527e6b7b9c506ea7142e4bbdf564d4c685c3.tar.xz
(svn r4481) - Fix: Validate the given sprite ID when loading a sprite.
Diffstat (limited to 'spritecache.c')
-rw-r--r--spritecache.c4
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;