CocoaMQTT versions prior to 2.2.2 contain a vulnerability in the parsing of PUBLISH packets where a malformed retained message with a zero-length topic can cause the client application to crash. This crash occurs due to an out-of-bounds range error in Swift when extracting the topic string, leading to a denial of service that persists until the retained message is removed from the MQTT broker.