Core/SAI: Fix crash

Disable script type SMART_SCRIPT_TYPE_TIMED_ACTIONLIST actions if they are trying to overwrite the timed action list while iterating it.
This was invalidating the iterator and deleting any smart action stored in it, including the current executed one.

Valgrind log:
 Invalid read of size 1
  at SmartScript::OnUpdate(unsigned int) (SmartScript.cpp:3258)
  by SmartAI::UpdateAI(unsigned int) (SmartAI.cpp:331)
  by Creature::Update(unsigned int) (Creature.cpp:544)
 Address 0x1807d9b2 is 10 bytes after a block of size 40 alloc'd
  at operator new(unsigned long) (vg_replace_malloc.c:319)
  ...
  by SmartAIMgr::LoadSmartAIFromDB() (SmartScriptMgr.cpp:231)
  by World::SetInitialWorldSettings() (World.cpp:1724)
  by Master::Run() (Master.cpp:169)
  by main (Main.cpp:142)
This commit is contained in:
jackpoz committed 2014-02-08 21:59:35 +01:00
1 parent aaa4b3a124
commit dbed818f6f
2 files changed
+13

No files matched your search

@@ -222,6 +222,7 @@ class SmartScript
SmartAIEventList mEvents;
SmartAIEventList mInstallEvents;
SmartAIEventList mTimedActionList;
bool isProcessingTimedActionList;
Creature* me;
uint64 meOrigGUID;
GameObject* go;