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

This commit is contained in:
arrai 2009-03-29 20:24:54 +02:00
parent ae42ce6418
commit ab7491e0e1
2 changed files with 7 additions and 2 deletions

View file

@ -20,6 +20,7 @@
#include "Policies/SingletonImp.h"
#include "Log.h"
#include "ProgressBar.h"
#include "SharedDefines.h"
#include "DBCfmt.h"
@ -391,9 +392,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;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7581"
#define REVISION_NR "7582"
#endif // __REVISION_NR_H__