From 366a827c9c85cdcc502358ee21a7b4d82540c8e0 Mon Sep 17 00:00:00 2001 From: Max Schwarz Date: Fri, 13 Aug 2021 12:39:18 +0200 Subject: [PATCH] topic_transport: receiver/depacketizer: prune before accessing the list This could potentially trigger a segfault when all messages are older than 5s. Maybe related: https://github.com/AIS-Bonn/nimbro_network/issues/17 --- nimbro_topic_transport/src/receiver/depacketizer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nimbro_topic_transport/src/receiver/depacketizer.cpp b/nimbro_topic_transport/src/receiver/depacketizer.cpp index 72273ec..73a86d0 100644 --- a/nimbro_topic_transport/src/receiver/depacketizer.cpp +++ b/nimbro_topic_transport/src/receiver/depacketizer.cpp @@ -35,10 +35,10 @@ void Depacketizer::addPacket(const Packet::Ptr& packet) if(it == m_messageBuffer.end()) { + pruneMessages(); + m_messageBuffer.push_front(PartialMessage(msg_id)); it = m_messageBuffer.begin(); - - pruneMessages(); } handleMessagePacket(it, packet);