talamortis / OregonCore

World of Warcraft 2.4.3 Server Emulator
GNU General Public License v2.0
69 stars 51 forks source link

Stack overflow #245

Open PadreWoW opened 3 years ago

PadreWoW commented 3 years ago

Describe the bug Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20352 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 32746 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20178 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20134 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20350

To Reproduce Steps to reproduce the behavior:

  1. I can see many errors: Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20352 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 32746 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20178 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20134 Prevent possible stack owerflow in Unit::ProcDamageAndSpellFor Spell 20350

Branch master

Eluna

HASH/COMMIT: https://github.com/talamortis/OregonCore/commit/cb0b1e3b0eaa0c079a6ef77a348127284a1703fe

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/97565734-stack-overflow?utm_campaign=plugin&utm_content=tracker%2F91676571&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F91676571&utm_medium=issues&utm_source=github).
PadreWoW commented 3 years ago

Bug is here:

https://github.com/OregonCore/OregonCore/commit/44dd48010b2a6fead95388eb2b65ce568c739c46#diff-464566e356b011427ea57048adf80183f8df0a2f3eb8845cfa38a7db82d9d78e

Exactly here in Unit.cpp:


        if (GetTypeId() == TYPEID_PLAYER && spellProcEvent && spellProcEvent->cooldown)
            cooldown = spellProcEvent->cooldown;

+        if (spellInfo->AttributesEx3 & SPELL_ATTR3_DISABLE_PROC)
+            ++m_procDeep;
+
        switch (auraModifier->m_auraname)
        {
        case SPELL_AURA_PROC_TRIGGER_SPELL:
@@ -11239,6 +11261,9 @@ void Unit::ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag,
                }
            }
        }
+
+       if (spellInfo->AttributesEx3 & SPELL_ATTR3_DISABLE_PROC)
+           --m_procDeep;
    }
    if (removedSpells.size())
    {