[7582] Prevent memory corruption at DBC loading. Thanks to Lynx3d for investigating that issue Author: arrai

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-29 17:19:47 -06:00
parent d0877fa006
commit 77d2786091

View File

@@ -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;