From 43392384ecac3b467fc2cf9519798ab4b0451f9a Mon Sep 17 00:00:00 2001 From: ijnek Date: Sun, 29 Oct 2023 23:11:02 +0000 Subject: [PATCH] Don't process JointPositions and JointStiffnesses message if message is invalid. This prevents segmentation faults. Signed-off-by: ijnek --- nao_lola_client/src/msgpack_packer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nao_lola_client/src/msgpack_packer.cpp b/nao_lola_client/src/msgpack_packer.cpp index dc631ca..c605ec4 100644 --- a/nao_lola_client/src/msgpack_packer.cpp +++ b/nao_lola_client/src/msgpack_packer.cpp @@ -56,6 +56,7 @@ void MsgpackPacker::setJointPositions( "Angles and Indexes vector must have the same length. " "Angles vector has length %zu, while indexes vector has length %zu", jointPositions.positions.size(), jointPositions.indexes.size()); + return; } for (unsigned i = 0; i < jointPositions.indexes.size(); ++i) { @@ -76,6 +77,7 @@ void MsgpackPacker::setJointStiffnesses( "Stiffnesses and Indexes vector must have the same length. " "Stiffnesses vector has length %zu, while indexes vector has length %zu", jointStiffnesses.stiffnesses.size(), jointStiffnesses.indexes.size()); + return; } for (unsigned i = 0; i < jointStiffnesses.indexes.size(); ++i) {