From 7487d10dbe6ce1059978c563eeda979c5b8ee9af Mon Sep 17 00:00:00 2001 From: ijnek Date: Mon, 30 Oct 2023 02:49:43 +0000 Subject: [PATCH] Don't process JointPositions and JointStiffnesses message if message is invalid. This prevents segmentation faults. (cherry picked from commit b3a8180741c5a873e82dbfb5c3b78830415a17a5) --- src/msgpack_packer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/msgpack_packer.cpp b/src/msgpack_packer.cpp index dae6b7e..42f19ce 100644 --- a/src/msgpack_packer.cpp +++ b/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) {