Skip to content

Commit

Permalink
Don't process JointPositions and JointStiffnesses message if message …
Browse files Browse the repository at this point in the history
…is invalid. This prevents segmentation faults.

(cherry picked from commit b3a8180)
  • Loading branch information
ijnek committed Oct 30, 2023
1 parent 35eaef5 commit 7487d10
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/msgpack_packer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 7487d10

Please sign in to comment.