mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 03:42:37 +01:00
[7582] Prevent memory corruption at DBC loading. Thanks to Lynx3d for investigating that issue Author: arrai
--HG-- branch : trunk
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user