aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStormBytePP <stormbyte@gmail.com>2015-08-20 05:42:16 +0200
committerStormBytePP <stormbyte@gmail.com>2015-08-20 15:42:27 +0200
commit6051d0c4f8f5161cfe6b63ee3e12f24b4378915f (patch)
tree5e76b65accc2e219aa4c3f480c7c8f9504fb784e /src
parent30fc4f9f63b7a0ce01e5aad4667902991b70e298 (diff)
Core/Build: Fixed bitshift undefined behavior
Coverity defect ID: 1193414
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 9ba7a62e215..f7491175a50 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1278,8 +1278,14 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
{
// Use the new aura to see on what stance the target will be
- uint32 newStance = (1<<((newAura ? newAura->GetMiscValue() : 0)-1));
-
+ uint32 newStance = 0;
+ if (newAura)
+ {
+ if (newAura->GetMiscValue() > 0 && newAura->GetMiscValue() <= 32) //Not null and GetMiscValue is not == FORM_NONE
+ newStance = 1 << (newAura->GetMiscValue() - 1);
+ else
+ TC_LOG_ERROR("spell.aura", "newAura->GetMiscValue() returned value %i for SpellID: %u when it was expecting a value in range [0..31] for a bitshift", newAura->GetMiscValue(), newAura->GetId());
+ }
// If the stances are not compatible with the spell, remove it
if (itr->second->GetBase()->IsRemovedOnShapeLost(target) && !(itr->second->GetBase()->GetSpellInfo()->Stances & newStance))
target->RemoveAura(itr);