From ff7d664d1e98fcc1a9940142c4fbe58f52a1a856 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 5 Oct 2014 18:32:59 +0000 Subject: [PATCH] Fix an oob access in parsedefinitions_game(). DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@4643 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/anim.h | 2 +- polymer/eduke32/source/game.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/polymer/eduke32/source/anim.h b/polymer/eduke32/source/anim.h index 2267b82a2..a60246628 100644 --- a/polymer/eduke32/source/anim.h +++ b/polymer/eduke32/source/anim.h @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #ifndef __anim_h__ #define __anim_h__ -#define NUM_HARDCODED_ANIMS 12 +#define NUM_HARDCODED_ANIMS 11 # ifdef USE_LIBVPX extern uint16_t anim_hi_numsounds[NUM_HARDCODED_ANIMS], *anim_hi_sounds[NUM_HARDCODED_ANIMS]; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3f968523c..e193a18c9 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9498,6 +9498,8 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload) // NUM_HARDCODED_ANIMS }; + EDUKE32_STATIC_ASSERT(ARRAY_SIZE(hardcoded_anim_tokens) == NUM_HARDCODED_ANIMS); + animnum = getatoken(script, hardcoded_anim_tokens, NUM_HARDCODED_ANIMS); if ((unsigned)animnum >= NUM_HARDCODED_ANIMS) initprintf("Error: expected a hardcoded anim file name (sans extension) on line %s:%d\n",