fix(Core/Conditions): ConditionList use after free (#23006)

This commit is contained in:
sogladev
2025-09-24 01:46:52 +02:00
committed by GitHub
parent ae1ea1a701
commit 6d2ad6047c
7 changed files with 59 additions and 65 deletions

View File

@@ -445,12 +445,25 @@ public:
void SelectEffectTypeImplicitTargets(uint8 effIndex);
uint32 GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList);
uint32 GetSearcherTypeMask(SpellTargetObjectTypes objType,
std::shared_ptr<ConditionList> condList);
template<class SEARCHER> void SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* referer, Position const* pos, float radius);
WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList = nullptr);
void SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList);
void SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, SpellTargetSelectionCategories selectCategory, ConditionList* condList, bool isChainHeal);
WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType,
SpellTargetCheckTypes selectionType,
std::shared_ptr<ConditionList> condList = nullptr);
void SearchAreaTargets(std::list<WorldObject *> &targets, float range,
Position const *position, Unit *referer,
SpellTargetObjectTypes objectType,
SpellTargetCheckTypes selectionType,
std::shared_ptr<ConditionList> condList);
void SearchChainTargets(std::list<WorldObject *> &targets,
uint32 chainTargets, WorldObject *target,
SpellTargetObjectTypes objectType,
SpellTargetCheckTypes selectType,
SpellTargetSelectionCategories selectCategory,
std::shared_ptr<ConditionList> condList,
bool isChainHeal);
SpellCastResult prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = nullptr);
void cancel(bool bySelf = false);
@@ -801,10 +814,10 @@ namespace Acore
SpellInfo const* _spellInfo;
SpellTargetCheckTypes _targetSelectionType;
ConditionSourceInfo* _condSrcInfo;
ConditionList* _condList;
std::shared_ptr<ConditionList> _condList;
WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList);
SpellTargetCheckTypes selectionType, std::shared_ptr<ConditionList> condList);
~WorldObjectSpellTargetCheck();
bool operator()(WorldObject* target);
};
@@ -814,7 +827,7 @@ namespace Acore
float _range;
Position const* _position;
WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo,
SpellTargetCheckTypes selectionType, ConditionList* condList);
SpellTargetCheckTypes selectionType, std::shared_ptr<ConditionList> condList);
bool operator()(WorldObject* target);
};
@@ -823,7 +836,7 @@ namespace Acore
float _range;
Position const* _position;
WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster,
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, std::shared_ptr<ConditionList> condList);
bool operator()(WorldObject* target);
};
@@ -831,14 +844,14 @@ namespace Acore
{
float _coneAngle;
WorldObjectSpellConeTargetCheck(float coneAngle, float range, Unit* caster,
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, std::shared_ptr<ConditionList> condList);
bool operator()(WorldObject* target);
};
struct WorldObjectSpellTrajTargetCheck : public WorldObjectSpellAreaTargetCheck
{
WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster,
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, std::shared_ptr<ConditionList> condList);
bool operator()(WorldObject* target);
};
}