From 56869ef7061bf5e220dd55798b8e7b889dd9b0af Mon Sep 17 00:00:00 2001 From: Philippe Capdepuy Date: Wed, 10 Apr 2019 09:37:20 +0200 Subject: [PATCH] fixed out of range indexing for angle_compensate --- src/node.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node.cpp b/src/node.cpp index 4b12ea6b..86c96bbc 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -334,7 +334,12 @@ int main(int argc, char * argv[]) { int angle_value = (int)(angle * angle_compensate_multiple); if ((angle_value - angle_compensate_offset) < 0) angle_compensate_offset = angle_value; for (j = 0; j < angle_compensate_multiple; j++) { - angle_compensate_nodes[angle_value-angle_compensate_offset+j] = nodes[i]; + int index = angle_value - angle_compensate_offset + j; + if (index >= angle_compensate_nodes_count) { + //ROS_WARN("skipping out of range compensate index %d for i %d",index,i); + continue; + } + angle_compensate_nodes[index] = nodes[i]; } } }