diff options
author | megamage <none@none> | 2009-03-29 17:19:47 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-03-29 17:19:47 -0600 |
commit | 77d27860919bd46d6f65d3e37e9f94bd5396cd1f (patch) | |
tree | 8e0afb968bbcce7e2131c8654266692ce19d593d /src | |
parent | d0877fa0069aabf8534089f38fe153badb88f45b (diff) |
[7582] Prevent memory corruption at DBC loading. Thanks to Lynx3d for investigating that issue Author: arrai
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/DBCStores.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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; |