From 918762501f5de7db655183e641acbe611fa71632 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sat, 14 Mar 2026 10:56:04 -0700 Subject: [PATCH] fix(combatlog): fail spell go parse on truncated target lists --- src/game/world_packets.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/game/world_packets.cpp b/src/game/world_packets.cpp index 82126379..c176650e 100644 --- a/src/game/world_packets.cpp +++ b/src/game/world_packets.cpp @@ -3758,11 +3758,14 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) { } const uint8_t storedHitLimit = std::min(rawHitCount, 128); + bool truncatedTargets = false; + data.hitTargets.reserve(storedHitLimit); for (uint16_t i = 0; i < rawHitCount; ++i) { // WotLK hit targets are packed GUIDs, like the caster and miss targets. if (!hasFullPackedGuid(packet)) { LOG_WARNING("Spell go: truncated hit targets at index ", i, "/", (int)rawHitCount); + truncatedTargets = true; break; } const uint64_t targetGuid = UpdateObjectParser::readPackedGuid(packet); @@ -3770,6 +3773,10 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) { data.hitTargets.push_back(targetGuid); } } + if (truncatedTargets) { + packet.setReadPos(startPos); + return false; + } data.hitCount = static_cast(data.hitTargets.size()); // Validate missCount field exists @@ -3789,18 +3796,21 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) { // REFLECT additionally appends uint32 reflectSpellId + uint8 reflectResult. if (!hasFullPackedGuid(packet)) { LOG_WARNING("Spell go: truncated miss targets at index ", i, "/", (int)rawMissCount); + truncatedTargets = true; break; } SpellGoMissEntry m; m.targetGuid = UpdateObjectParser::readPackedGuid(packet); // packed GUID in WotLK if (packet.getSize() - packet.getReadPos() < 1) { LOG_WARNING("Spell go: missing missType at miss index ", i, "/", (int)rawMissCount); + truncatedTargets = true; break; } m.missType = packet.readUInt8(); if (m.missType == 11) { if (packet.getSize() - packet.getReadPos() < 5) { LOG_WARNING("Spell go: truncated reflect payload at miss index ", i, "/", (int)rawMissCount); + truncatedTargets = true; break; } (void)packet.readUInt32(); @@ -3810,6 +3820,10 @@ bool SpellGoParser::parse(network::Packet& packet, SpellGoData& data) { data.missTargets.push_back(m); } } + if (truncatedTargets) { + packet.setReadPos(startPos); + return false; + } data.missCount = static_cast(data.missTargets.size()); LOG_DEBUG("Spell go: spell=", data.spellId, " hits=", (int)data.hitCount,