mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-09 02:30:29 +00:00
fix(Core/Misc): prevent crash and undefined behavior in Warden destructor and Object visibility (#24900)
This commit is contained in:
@@ -1763,7 +1763,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
|
||||
// pussywizard: arena spectator
|
||||
if (obj->IsPlayer())
|
||||
if (((Player const*)obj)->IsSpectator() && ((Player const*)obj)->FindMap()->IsBattleArena())
|
||||
if (((Player const*)obj)->IsSpectator() && ((Player const*)obj)->FindMap() && ((Player const*)obj)->FindMap()->IsBattleArena())
|
||||
return false;
|
||||
|
||||
bool corpseVisibility = false;
|
||||
@@ -1807,11 +1807,12 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
return false;
|
||||
|
||||
// pussywizard: during arena preparation, don't allow to detect pets if can't see its owner (spoils enemy arena frames)
|
||||
if (target->IsPet() && target->GetOwnerGUID() && target->FindMap()->IsBattleArena() && GetGUID() != target->GetOwnerGUID())
|
||||
if (BattlegroundMap* bgmap = target->FindMap()->ToBattlegroundMap())
|
||||
if (Battleground* bg = bgmap->GetBG())
|
||||
if (bg->GetStatus() < STATUS_IN_PROGRESS && !thisPlayer->HaveAtClient(target->GetOwnerGUID()))
|
||||
return false;
|
||||
if (Map* targetMap = target->FindMap())
|
||||
if (target->IsPet() && target->GetOwnerGUID() && targetMap->IsBattleArena() && GetGUID() != target->GetOwnerGUID())
|
||||
if (BattlegroundMap* bgmap = targetMap->ToBattlegroundMap())
|
||||
if (Battleground* bg = bgmap->GetBG())
|
||||
if (bg->GetStatus() < STATUS_IN_PROGRESS && !thisPlayer->HaveAtClient(target->GetOwnerGUID()))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (thisPlayer->GetFarSightDistance() && !thisPlayer->isInFront(obj))
|
||||
@@ -1856,7 +1857,7 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
|
||||
// pussywizard: arena spectator
|
||||
if (this->IsPlayer())
|
||||
if (((Player const*)this)->IsSpectator() && ((Player const*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags()))
|
||||
if (((Player const*)this)->IsSpectator() && ((Player const*)this)->FindMap() && ((Player const*)this)->FindMap()->IsBattleArena() && (obj->m_invisibility.GetFlags() || obj->m_stealth.GetFlags()))
|
||||
return false;
|
||||
|
||||
if (!CanDetect(obj, ignoreStealth, !distanceCheck, checkAlert))
|
||||
|
||||
@@ -38,9 +38,12 @@ Warden::Warden() : _session(nullptr), _checkTimer(10000/*10 sec*/), _clientRespo
|
||||
|
||||
Warden::~Warden()
|
||||
{
|
||||
delete[] _module->CompressedData;
|
||||
delete _module;
|
||||
_module = nullptr;
|
||||
if (_module)
|
||||
{
|
||||
delete[] _module->CompressedData;
|
||||
delete _module;
|
||||
_module = nullptr;
|
||||
}
|
||||
_initialized = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,12 @@ ClientWardenModule* WardenMac::GetModuleForClient()
|
||||
{
|
||||
auto mod = new ClientWardenModule;
|
||||
|
||||
uint32 length = Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.size();
|
||||
|
||||
// data assign
|
||||
mod->CompressedSize = Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.size();
|
||||
mod->CompressedData = Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.data();
|
||||
mod->CompressedSize = length;
|
||||
mod->CompressedData = new uint8[length];
|
||||
memcpy(mod->CompressedData, Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data.data(), length);
|
||||
|
||||
// md5 hash
|
||||
mod->Id = Acore::Crypto::MD5::GetDigestOf(mod->CompressedData, mod->CompressedSize);
|
||||
|
||||
Reference in New Issue
Block a user