(svn r4481) - Fix: Validate the given sprite ID when loading a sprite.
authorpeter1138
Thu, 20 Apr 2006 05:57:47 +0000
changeset 3591 a5febb93bc11
parent 3590 215fc77ee7c6
child 3592 f4f185314df8
(svn r4481) - Fix: Validate the given sprite ID when loading a sprite.
spritecache.c
--- a/spritecache.c	Wed Apr 19 16:10:17 2006 +0000
+++ b/spritecache.c	Thu Apr 20 05:57:47 2006 +0000
@@ -149,6 +149,10 @@
 
 	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;