From dbc1df4d080e73b8f9e2463339cc17f8d78a23a3 Mon Sep 17 00:00:00 2001 From: Salih Marangoz Date: Sat, 16 Feb 2019 12:32:30 +0300 Subject: [PATCH] Fixed angle_compensate_nodes array overflow issue On A2, angle_compensate_nodes size is 720 but sometimes angle_value-angle_compensate_offset+j becomes equal to 720. This causes overflow at line 313 --- src/node.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.cpp b/src/node.cpp index d3442ea0..23e5ba7c 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -300,7 +300,7 @@ int main(int argc, char * argv[]) { //const int angle_compensate_multiple = 1; const int angle_compensate_nodes_count = 360*angle_compensate_multiple; int angle_compensate_offset = 0; - rplidar_response_measurement_node_hq_t angle_compensate_nodes[angle_compensate_nodes_count]; + rplidar_response_measurement_node_hq_t angle_compensate_nodes[angle_compensate_nodes_count+8]; memset(angle_compensate_nodes, 0, angle_compensate_nodes_count*sizeof(rplidar_response_measurement_node_hq_t)); int i = 0, j = 0;