mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
fix(combatlog): fail spell go parse on truncated target lists
This commit is contained in:
parent
43cc2635ac
commit
0c7dfdebe9
1 changed files with 14 additions and 0 deletions
|
|
@ -3758,11 +3758,14 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) {
|
||||||
}
|
}
|
||||||
const uint8_t storedHitLimit = std::min<uint8_t>(rawHitCount, 128);
|
const uint8_t storedHitLimit = std::min<uint8_t>(rawHitCount, 128);
|
||||||
|
|
||||||
|
bool truncatedTargets = false;
|
||||||
|
|
||||||
data.hitTargets.reserve(storedHitLimit);
|
data.hitTargets.reserve(storedHitLimit);
|
||||||
for (uint16_t i = 0; i < rawHitCount; ++i) {
|
for (uint16_t i = 0; i < rawHitCount; ++i) {
|
||||||
// WotLK hit targets are packed GUIDs, like the caster and miss targets.
|
// WotLK hit targets are packed GUIDs, like the caster and miss targets.
|
||||||
if (!hasFullPackedGuid(packet)) {
|
if (!hasFullPackedGuid(packet)) {
|
||||||
LOG_WARNING("Spell go: truncated hit targets at index ", i, "/", (int)rawHitCount);
|
LOG_WARNING("Spell go: truncated hit targets at index ", i, "/", (int)rawHitCount);
|
||||||
|
truncatedTargets = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const uint64_t targetGuid = UpdateObjectParser::readPackedGuid(packet);
|
const uint64_t targetGuid = UpdateObjectParser::readPackedGuid(packet);
|
||||||
|
|
@ -3770,6 +3773,10 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) {
|
||||||
data.hitTargets.push_back(targetGuid);
|
data.hitTargets.push_back(targetGuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (truncatedTargets) {
|
||||||
|
packet.setReadPos(startPos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
data.hitCount = static_cast<uint8_t>(data.hitTargets.size());
|
data.hitCount = static_cast<uint8_t>(data.hitTargets.size());
|
||||||
|
|
||||||
// Validate missCount field exists
|
// Validate missCount field exists
|
||||||
|
|
@ -3789,18 +3796,21 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) {
|
||||||
// REFLECT additionally appends uint32 reflectSpellId + uint8 reflectResult.
|
// REFLECT additionally appends uint32 reflectSpellId + uint8 reflectResult.
|
||||||
if (!hasFullPackedGuid(packet)) {
|
if (!hasFullPackedGuid(packet)) {
|
||||||
LOG_WARNING("Spell go: truncated miss targets at index ", i, "/", (int)rawMissCount);
|
LOG_WARNING("Spell go: truncated miss targets at index ", i, "/", (int)rawMissCount);
|
||||||
|
truncatedTargets = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SpellGoMissEntry m;
|
SpellGoMissEntry m;
|
||||||
m.targetGuid = UpdateObjectParser::readPackedGuid(packet); // packed GUID in WotLK
|
m.targetGuid = UpdateObjectParser::readPackedGuid(packet); // packed GUID in WotLK
|
||||||
if (packet.getSize() - packet.getReadPos() < 1) {
|
if (packet.getSize() - packet.getReadPos() < 1) {
|
||||||
LOG_WARNING("Spell go: missing missType at miss index ", i, "/", (int)rawMissCount);
|
LOG_WARNING("Spell go: missing missType at miss index ", i, "/", (int)rawMissCount);
|
||||||
|
truncatedTargets = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
m.missType = packet.readUInt8();
|
m.missType = packet.readUInt8();
|
||||||
if (m.missType == 11) {
|
if (m.missType == 11) {
|
||||||
if (packet.getSize() - packet.getReadPos() < 5) {
|
if (packet.getSize() - packet.getReadPos() < 5) {
|
||||||
LOG_WARNING("Spell go: truncated reflect payload at miss index ", i, "/", (int)rawMissCount);
|
LOG_WARNING("Spell go: truncated reflect payload at miss index ", i, "/", (int)rawMissCount);
|
||||||
|
truncatedTargets = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
(void)packet.readUInt32();
|
(void)packet.readUInt32();
|
||||||
|
|
@ -3810,6 +3820,10 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) {
|
||||||
data.missTargets.push_back(m);
|
data.missTargets.push_back(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (truncatedTargets) {
|
||||||
|
packet.setReadPos(startPos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
data.missCount = static_cast<uint8_t>(data.missTargets.size());
|
data.missCount = static_cast<uint8_t>(data.missTargets.size());
|
||||||
|
|
||||||
LOG_DEBUG("Spell go: spell=", data.spellId, " hits=", (int)data.hitCount,
|
LOG_DEBUG("Spell go: spell=", data.spellId, " hits=", (int)data.hitCount,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue