diff options
author | jackpoz <giacomopoz@gmail.com> | 2015-08-20 15:52:28 +0200 |
---|---|---|
committer | jackpoz <giacomopoz@gmail.com> | 2015-08-20 15:52:28 +0200 |
commit | e287d243a3e4b58b597e284f32f6c59b6417c7e2 (patch) | |
tree | 8ff2b6392777835301b8090e4d9b3d6af5f0ff0d | |
parent | 51a2a3fa93702f289cda1e64323f55aba02f1026 (diff) | |
parent | 6051d0c4f8f5161cfe6b63ee3e12f24b4378915f (diff) |
Merge pull request #15314 from StormBytePP/3.3.5_bitshift_undefined_behaviour_fix
Core/Build: Fixed bitshift undefined behavior
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 10 |
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); |