Commit Graph

7946 Commits

Author SHA1 Message Date
Shauren
4f44cdf2b5 Core/Scripts: Fixed uninitialized variable and memory leaks 2013-08-26 17:38:02 +02:00
Shauren
664ed816df Merge pull request #10636 from jackpoz/mindvision_fix
Core/Aura: Fix SPELL_AURA_BIND_SIGHT invalid read
2013-08-26 08:23:44 -07:00
Nay
2050a36b58 SAI & Scripts: Fix unitialized values found by Valgrind
==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x19B3031: boss_skarvald_the_constructor::boss_skarvald_the_constructorAI::UpdateAI(unsigned int) (boss_skarvald_dalronn.cpp:217)

==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x19B3948: boss_dalronn_the_controller::boss_dalronn_the_controllerAI::UpdateAI(unsigned int) (boss_skarvald_dalronn.cpp:388)

==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x15E2FCC: SmartScript::ProcessAction(SmartScriptHolder&, Unit*, unsigned int, unsigned int, bool, SpellInfo const*, GameObject*) (SmartScript.cpp:144)
==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x191CB98: dummy_dragonAI::UpdateAI(unsigned int) (boss_sartharion.cpp:961)
==3064==    by 0x191D242: npc_shadron::npc_shadronAI::UpdateAI(unsigned int) (boss_sartharion.cpp:1122)
==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x19AE913: boss_ymiron::boss_ymironAI::UpdateAI(unsigned int) (boss_ymiron.cpp:215)

==3064== Use of uninitialised value of size 8
...
==3064==    by 0x18A9F4A: boss_illidan_stormrage::boss_illidan_stormrageAI::Reset() (boss_illidan.cpp:1805)

==3064== Conditional jump or move depends on uninitialised value(s)
...
==3064==    by 0x18A9F4A: boss_illidan_stormrage::boss_illidan_stormrageAI::Reset() (boss_illidan.cpp:1805)

==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x191CB98: dummy_dragonAI::UpdateAI(unsigned int) (boss_sartharion.cpp:961)
==3064==    by 0x191CE88: npc_tenebron::npc_tenebronAI::UpdateAI(unsigned int) (boss_sartharion.cpp:1027)

==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x191CB98: dummy_dragonAI::UpdateAI(unsigned int) (boss_sartharion.cpp:961)
==3064==    by 0x191D5B8: npc_vesperon::npc_vesperonAI::UpdateAI(unsigned int) (boss_sartharion.cpp:1220)

==3064== Conditional jump or move depends on uninitialised value(s)
...
==3064==    by 0x1868F59: boss_lady_vashj::boss_lady_vashjAI::Reset() (boss_lady_vashj.cpp:206)

==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x191C14C: dummy_dragonAI::MovementInform(unsigned int, unsigned int) (boss_sartharion.cpp:802)

==3064== Conditional jump or move depends on uninitialised value(s)
==3064==    at 0x1046986: Position::NormalizeOrientation(float) (Object.h:388)
...
==3064==    by 0x17D9463: boss_malchezaar::boss_malchezaarAI::SummonInfernal(unsigned int) (boss_prince_malchezaar.cpp:373)
2013-08-26 16:13:26 +01:00
jackpoz
2a47b602d7 Core/Aura: Fix SPELL_AURA_BIND_SIGHT invalid read
Mind Vision has Aura Effect SPELL_AURA_BIND_SIGHT which adds the target to a special Map container i_objectsToSwitch, used to switch grid containers for target Creatures of this Aura Effect.

When the target is a Creature, when the Creature is removed from world it's added to i_objectsToSwitch and then to i_objectsToRemove, iterated in this order in Map::RemoveAllObjectsInRemoveList() so the reference in i_objectsToSwitch is valid.
When the target is a Player, when the Player logs out it's added to i_objectsToSwitch but then Map::RemovePlayerFromMap() deletes the Player, leaving an invalid reference in i_objectsToSwitch.

Since the whole point of i_objectsToSwitch is to store Creatures and since the stored references are used only if the condition "GetTypeId() == TYPEID_UNIT" is verified, it's safe to add only objects of TYPEID_UNIT type to the container.

Valgrind log:
 Invalid read of size 4
   at 0xC52332: Object::GetTypeId() const (Object.h:140)
   by 0xF540D3: Map::RemoveAllObjectsInRemoveList() (Map.cpp:2136)
   by 0xF53CD2: Map::DelayedUpdate(unsigned int) (Map.cpp:2087)
   by 0xF639B1: MapManager::Update(unsigned int) (MapManager.cpp:292)
   by 0x107CB40: World::Update(unsigned int) (World.cpp:2025)
   by 0xBEB263: WorldRunnable::run() (WorldRunnable.cpp:60)
   by 0x1213792: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
   by 0x515EA35: ACE_OS_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so)
   by 0x5F19F8D: start_thread (pthread_create.c:311)
   by 0x6A46E1C: clone (clone.S:113)
 Address 0x401eacac is 12 bytes inside a block of size 11,736 free'd
   at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0xD80239: Player::~Player() (Player.cpp:915)
   by 0xF4D5A2: void Map::DeleteFromWorld<Player>(Player*) (Map.cpp:319)
   by 0xF4EBBB: Map::RemovePlayerFromMap(Player*, bool) (Map.cpp:687)
   by 0xFCC18D: WorldSession::LogoutPlayer(bool) (WorldSession.cpp:531)
   by 0xF1EDD5: WorldSession::HandleLogoutRequestOpcode(WorldPacket&) (MiscHandler.cpp:403)
   by 0xFCAE37: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
   by 0x107EBC6: World::UpdateSessions(unsigned int) (World.cpp:2615)
   by 0x107C94B: World::Update(unsigned int) (World.cpp:1978)
   by 0xBEB263: WorldRunnable::run() (WorldRunnable.cpp:60)
   by 0x1213792: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
   by 0x515EA35: ACE_OS_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so)
2013-08-26 16:49:02 +02:00
Nay
9327832896 Merge pull request #10633 from jackpoz/createguild_fix
Core/Guild: Fix uninitialized value on guild creation
2013-08-26 05:27:31 -07:00
jackpoz
287eb260b5 Core/Guild: Fix uninitialized value on guild creation
Fix GuildMember flags left uninitialized when creating a new guild.

Valgrind log:
 Conditional jump or move depends on uninitialised value(s)
  at 0xEE49CE: Guild::Member::WritePacket(WorldPacket&) const (Guild.cpp:714)
  by 0xEE721E: Guild::HandleRoster(WorldSession*) (Guild.cpp:1314)
  by 0xEE9EBA: Guild::SendLoginInfo(WorldSession*) (Guild.cpp:1920)
  by 0xEEB689: Guild::AddMember(unsigned long, unsigned char) (Guild.cpp:2230)
  by 0xEE6A09: Guild::Create(Player*, std::string const&) (Guild.cpp:1199)
  by 0x12A71F9: guild_commandscript::HandleGuildCreateCommand(ChatHandler*, char const*) (cs_guild.cpp:92)
  by 0xC47DBE: ChatHandler::ExecuteCommandInTable(ChatCommand*, char const*, std::string const&) (Chat.cpp:362)
  by 0xC47C23: ChatHandler::ExecuteCommandInTable(ChatCommand*, char const*, std::string const&) (Chat.cpp:343)
  by 0xC488C4: ChatHandler::ParseCommands(char const*) (Chat.cpp:489)
  by 0x1188EE3: WorldSession::HandleMessagechatOpcode(WorldPacket&) (ChatHandler.cpp:217)
  by 0xFCAE37: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0x107EBC6: World::UpdateSessions(unsigned int) (World.cpp:2615)
2013-08-26 14:01:19 +02:00
Nay
8eaf763235 Core&Tools: Fix multiple issues found by a static code coverage tool 2013-08-26 02:00:18 +01:00
Machiavelli
39ccd4a460 Merge pull request #10624 from jackpoz/instancesavemgr
Core/Instances: Fix mutex released after being deleted
2013-08-25 12:14:50 -07:00
jackpoz
a3bdf90b0a Core/Instances: Fix mutex released after being deleted
Modify how InstanceSave is deleted so the local mutex can be released before deleting the class itself.

Valgrind log:
 Invalid read of size 4
  at 0x662662B: __pthread_mutex_unlock_usercnt (pthread_mutex_unlock.c:52)
  by 0x55D3C55: ACE_OS::mutex_unlock(pthread_mutex_t*) (OS_NS_Thread.cpp:2335)
  by 0xB20057: Player::CleanupsBeforeDelete(bool) (OS_NS_Thread.inl:3519)
  by 0xD0E2FA: WorldSession::LogoutPlayer(bool) (WorldSession.cpp:527)
  by 0xC66D34: WorldSession::HandleLogoutRequestOpcode(WorldPacket&) (MiscHandler.cpp:403)
  by 0xD0EA82: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0xD9AD66: World::UpdateSessions(unsigned int) (World.cpp:2615)
  by 0xD9BEC4: World::Update(unsigned int) (World.cpp:1978)
  by 0xA035E5: WorldRunnable::run() (WorldRunnable.cpp:60)
  by 0xEC8D39: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:183)
  by 0x55D7555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
  by 0x6622B4F: start_thread (pthread_create.c:304)
Address 0x1884bb08 is 56 bytes inside a block of size 104 free'd
  at 0x4C279DC: operator delete(void*) (vg_replace_malloc.c:457)
  by 0xC9D533: InstanceSaveManager::RemoveInstanceSave(unsigned int) (InstanceSaveMgr.cpp:159)
  by 0xC9E826: InstanceSave::UnloadIfEmpty() (InstanceSaveMgr.cpp:238)
  by 0xB2003E: Player::CleanupsBeforeDelete(bool) (InstanceSaveMgr.h:84)
  by 0xD0E2FA: WorldSession::LogoutPlayer(bool) (WorldSession.cpp:527)
  by 0xC66D34: WorldSession::HandleLogoutRequestOpcode(WorldPacket&) (MiscHandler.cpp:403)
  by 0xD0EA82: WorldSession::Update(unsigned int, PacketFilter&) (WorldSession.cpp:312)
  by 0xD9AD66: World::UpdateSessions(unsigned int) (World.cpp:2615)
  by 0xD9BEC4: World::Update(unsigned int) (World.cpp:1978)
  by 0xA035E5: WorldRunnable::run() (WorldRunnable.cpp:60)
  by 0xEC8D39: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:183)
  by 0x55D7555: ACE_OS_Thread_Adapter::invoke() (OS_Thread_Adapter.cpp:103)
2013-08-25 19:08:22 +02:00
Nay
3e2f037b20 Core&Tools: Fix warnings and non-pch build 2013-08-25 14:27:40 +01:00
jackpoz
ee3d3ab1ff Core/Player: Fix uninitialized Player field.
m_MonthlyQuestChanged was initialized only when loading a Player from DB and left uninitialized when creating a new Player.

Valgrind log:
 Conditional jump or move depends on uninitialised value(s)
   at 0x1148E2A: Player::_SaveMonthlyQuestStatus(Trinity::AutoPtr<Transaction, ACE_Thread_Mutex>&) (Player.cpp:19694)
   by 0x1146510: Player::SaveToDB(bool) (Player.cpp:19191)
   by 0x14F5D5C: WorldSession::HandleCharCreateCallback(Trinity::AutoPtr<PreparedResultSet, ACE_Thread_Mutex>, CharacterCreateInfo*) (CharacterHandler.cpp:660)

Closes #10620

Signed-off-by: Nay <dnpd.dd@gmail.com>
2013-08-25 14:04:17 +01:00
raczman
ba22baebbd Core/Auth: Implement time-based token for user login as described in RFC 6238.
New column in account table is a base32 of token key bytes,
coincidentally it is the same format Google's Authenticator Android app uses.
If you want that to work, set system time on server correctly and use ntpd.

Closes #10527

Signed-off-by: Nay <dnpd.dd@gmail.com>
2013-08-25 14:02:40 +01:00
jackpoz
e96aa444b0 Core/Threading: Fix race condition in Thread
Increment the reference count of m_task in Thread::start() before spawning the actual Thread that will execute the task, otherwise the thread might finish, decRef the task and delete it.

Valgrind log of the issue:
 Invalid read of size 8
   at 0x1314CAD: ACE_Atomic_Op_GCC<long>::operator++() (Atomic_Op_GCC_T.inl:34)
   by 0x15933FB: ACE_Based::Runnable::incReference() (Threading.h:36)
   by 0x1592D2D: ACE_Based::Thread::start() (Threading.cpp:136)
   by 0x1592C37: ACE_Based::Thread::Thread(ACE_Based::Runnable*) (Threading.cpp:111)
   by 0xF6C463: Master::Run() (Master.cpp:195)
   by 0xF725D0: main (Main.cpp:142)
 Address 0x26137278 is 8 bytes inside a block of size 24 free'd
   at 0x4C2B59C: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
   by 0xF67FDB: RARunnable::~RARunnable() (RARunnable.cpp:55)
   by 0x1593441: ACE_Based::Runnable::decReference() (Threading.h:40)
   by 0x1592E92: ACE_Based::Thread::ThreadTask(void*) (Threading.cpp:186)
   by 0x515EA35: ACE_OS_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so)
   by 0x5F19F8D: start_thread (pthread_create.c:311)
   by 0x6A46E1C: clone (clone.S:113)

Closes #10619
2013-08-25 13:48:55 +01:00
Nay
12973de799 Core&Tools: Fix multiple issues found by a static code coverage tool 2013-08-24 22:57:22 +01:00
jackpoz
21459739c6 Fix uninitialized UpdateMask field
Initialized UpdateMask::_bits to NULL in all constructors.
UpdateMask(UpdateMask const& right) constructor sets the field count with SetCount() method before any field initialization. This means that SetCount() will call delete[] on the uninitialized _bits pointer field, leading to undefined behavior.
2013-08-24 17:49:14 +02:00
Nay
58e6503eef Core/Settings: Fix build in non cpp11 compilers
std::string back() was only introduced in C++11, a pity..
2013-08-24 15:45:19 +01:00
Nay
cc3055f344 Core/Settings: Fix a crash if worldserver.conf DataDir setting is empty 2013-08-24 14:30:17 +01:00
Nay
0d5181af4d Merge pull request #10559 from Discover-/Taxi-Benchmarking
Core/Misc: Implement CMSG_SET_TAXI_BENCHMARK_MODE to toggle PLAYER_FLAGS...
2013-08-23 17:57:21 -07:00
Nay
a0a377a0ce Scripts: Fix two issues found by Valgrind
==3400== Invalid write of size 8
==3400==    at 0x1241C32: instance_ahnkahet::GetInstanceScript(InstanceMap*) const (instance_ahnkahet.cpp:54)
...
==3400== Conditional jump or move depends on uninitialised value(s)
==3400==    at 0xB5DEAE: std::tr1::_Hashtable<unsigned long, std::pair<unsigned long const, Creature*>, std::allocator<std::pair<unsigned long const, Creature*> >, std::_Select1st<std::pair<unsigned long const, Creature*> >, std::equal_to<unsigned long>, std::tr1::hash<unsigned long>, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true>::_M_find_node(std::tr1::__detail::_Hash_node<std::pair<unsigned long const, Creature*>, false>*, unsigned long const&, unsigned long) const (hashtable.h:830)
==3400==    by 0xBDA4CA: std::tr1::_Hashtable<unsigned long, std::pair<unsigned long const, Creature*>, std::allocator<std::pair<unsigned long const, Creature*> >, std::_Select1st<std::pair<unsigned long const, Creature*> >, std::equal_to<unsigned long>, std::tr1::hash<unsigned long>, std::tr1::__detail::_Mod_range_hashing, std::tr1::__detail::_Default_ranged_hash, std::tr1::__detail::_Prime_rehash_policy, false, false, true>::find(unsigned long const&) (hashtable.h:698)
==3400==    by 0xBDA5BF: HashMapHolder<Creature>::Find(unsigned long) (ObjectAccessor.h:67)
==3400==    by 0xCB5C03: Map::GetCreature(unsigned long) (ObjectAccessor.h:114)
==3400==    by 0xB6E6EF: Unit::GetCreature(WorldObject&, unsigned long) (Unit.cpp:13023)
==3400==    by 0x10F0790: boss_hydross_the_unstable::boss_hydross_the_unstableAI::Reset() (boss_hydross_the_unstable.cpp:164)
2013-08-24 01:54:37 +01:00
Shauren
da693bbc81 Scripts/Halls of Reflection: Fixed accessing uninitialized memory 2013-08-23 18:45:17 +02:00
Aokromes
b5362c5c45 Script/Ahnkahet: Fix warning 2013-08-23 14:47:38 +02:00
joschiwald
99081bcf54 Merge branch 'master' of github.com:TrinityCore/TrinityCore 2013-08-22 13:48:47 +02:00
joschiwald
8e833743d4 Scripts/GruulsLair: reworked InstanceScript
Known Issue: position desynch after creature respawn
2013-08-22 13:47:54 +02:00
Vincent-Michael
dc86e87f25 Scripted/ShadeOfAkama: Some cleanups 2013-08-21 19:58:12 +02:00
joschiwald
a383885f5c Scripts/AhnKahet: reworked InstanceScript 2013-08-21 19:43:46 +02:00
Vincent-Michael
1e89ae1960 Core: Fix warnings and random changes 2013-08-21 18:46:52 +02:00
joschiwald
62c7e309ee Scripts/BlackTemple: reworked InstanceScript 2013-08-21 12:29:28 +02:00
joschiwald
7a14e366ac Scripts/AzjolNerub: reworked InstanceScript 2013-08-20 23:05:00 +02:00
Shauren
296da5df12 Core/Commands: Improved debug moveflags to also send associated opcodes 2013-08-20 21:16:54 +02:00
joschiwald
7e3a52bb42 Scripts/HallsOfLightning: reworked InstanceScript 2013-08-20 18:11:41 +02:00
Shauren
75cc4e7b25 Core/Auras
* Fixed unsafe removal of charm auras, it is now safe to remove them inside AI hooks
* Fixes crash in SmartAI::EnterEvadeMode

Closes #8679
2013-08-20 00:43:03 +02:00
Shauren
44485a74ad Scripts/Icecrown Citadel: Fixed Ice Tomb targeting tanks in phase 3 in Sindragosa encounter
Closes #8778
2013-08-19 22:16:05 +02:00
joschiwald
e0f010b310 Scripts: Random script fixes and code optimizations 2013-08-19 20:03:06 +02:00
Vincent-Michael
7679145da5 Core: Fix warning 2013-08-19 15:04:45 +02:00
QAston
dedeb5f9eb Fix build with gcc. Thanks to McBitter for testing. 2013-08-19 14:52:17 +02:00
QAston
0513d9c8d0 Core: Fix warnings. Make callback symbols local. 2013-08-18 20:30:38 +02:00
QAston
19343ddd55 Fix crashed caused by using openssl from multiple threads simultanously.
Note that this doesn't make BigNumber class threadsafe - it never was that way.
2013-08-18 17:44:04 +02:00
QAston
2a3370929d Fix BigNumber::AsByteArray function by returning Auto_Ptr.
Remove mutex from BigNumber class - it didn't do what it was advertised to do - consider using the "locked" array outside of the function in which it was "locked".
2013-08-18 17:44:03 +02:00
QAston
8160633e12 Core: Fix a bug in BigNumber::SetBinary 2013-08-18 17:44:02 +02:00
QAston
10fb50ad66 Core: Fix a bug in BigNumber::SetQword 2013-08-18 17:44:02 +02:00
Shauren
6a55395e4f Core/Players: Do not add banned characters to _legitCharacters container 2013-08-18 15:23:39 +02:00
Vincent-Michael
9eb01d63bd Core: Fix warnings 2013-08-18 13:54:20 +02:00
Vincent-Michael
7dbf68cbfc Scripted/Misc: Remove some whitespace 2013-08-18 02:07:13 +02:00
joschiwald
2b19ba1879 Misc: replace Unit::GetPlayer with ObjectAccessor::GetPlayer and some cosmetic changes 2013-08-18 01:41:10 +02:00
Vincent-Michael
c32dbd1432 Core/Spells: Fix hunter T7 4P Bonus
Closes #8320
2013-08-18 00:55:44 +02:00
Vincent-Michael
da1e466bd5 Core/Misc: Implemented GetObjectScale function 2013-08-17 23:47:43 +02:00
w1sht0l1v3
1ad954e215 Core/Scripts: Placeholders for instances Maraudon and Dire Maul.
It is needed for Random Dungeon Finder credit.
2013-08-17 19:14:48 +03:00
w1sht0l1v3
7c7f19228e Core/Scripts: Placeholders for instances The Slave Pens and The Underbog.
It is needed for Random Dungeon Finder credit.
2013-08-17 17:50:33 +03:00
w1sht0l1v3
0333d22fe9 Core/Scripts: Placeholder for instance Ragefire Chasm.
It is needed for Random Dungeon Finder credit.
2013-08-17 15:25:09 +03:00
Discover-
77f1d3a328 Core/Misc: Implement CMSG_SET_TAXI_BENCHMARK_MODE to toggle PLAYER_FLAGS_TAXI_BENCHMARK based on arguments. To enable/disable this, call '/script SetTaxiBenchmarkMode(1)' (1 = on, 0 = off). Basically debugs the taxi flight and outputs min, max and avg FPS during flight. Automatically toggled off when flight ends. 2013-08-17 14:17:38 +02:00