From 77d27860919bd46d6f65d3e37e9f94bd5396cd1f Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 29 Mar 2009 17:19:47 -0600 Subject: [7582] Prevent memory corruption at DBC loading. Thanks to Lynx3d for investigating that issue Author: arrai --HG-- branch : trunk --- src/game/DBCStores.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/game/DBCStores.cpp b/src/game/DBCStores.cpp index eed2e2c8a50..322ffca5d20 100644 --- a/src/game/DBCStores.cpp +++ b/src/game/DBCStores.cpp @@ -22,6 +22,7 @@ #include "Policies/SingletonImp.h" #include "Log.h" #include "ProgressBar.h" +#include "SharedDefines.h" #include "DBCfmt.h" @@ -393,9 +394,13 @@ void LoadDBCStores(const std::string& dataPath) if(!talentTabInfo) continue; + // prevent memory corruption; otherwise cls will become 12 below + if (! talentTabInfo->ClassMask & CLASSMASK_ALL_PLAYABLE) + continue; + // store class talent tab pages uint32 cls = 1; - for(uint32 m=1;!(m & talentTabInfo->ClassMask) && cls < 12 /*MAX_CLASSES*/;m <<=1, ++cls) {} + for(uint32 m=1;!(m & talentTabInfo->ClassMask) && cls < MAX_CLASSES;m <<=1, ++cls) {} sTalentTabPages[cls][talentTabInfo->tabpage]=talentTabId; -- cgit v1.2.3