Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use adaptive array size to avoid SIGSEGV #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use adaptive array size to avoid SIGSEGV
Jingye Qiu committed Jan 9, 2024
commit c32f938d1527ad5ca54aa2da3dcad89af9424835
30 changes: 14 additions & 16 deletions src/lio/LidarFeatureExtractor.cpp
Original file line number Diff line number Diff line change
@@ -89,17 +89,16 @@ bool LidarFeatureExtractor::plane_judge(const std::vector<PointType>& point_list
void LidarFeatureExtractor::detectFeaturePoint(pcl::PointCloud<PointType>::Ptr& cloud,
std::vector<int>& pointsLessSharp,
std::vector<int>& pointsLessFlat){
int CloudFeatureFlag[20000];
float cloudCurvature[20000];
float cloudDepth[20000];
int cloudSortInd[20000];
float cloudReflect[20000];
int reflectSortInd[20000];
int cloudAngle[20000];

pcl::PointCloud<PointType>::Ptr& laserCloudIn = cloud;

int cloudSize = laserCloudIn->points.size();
int CloudFeatureFlag[cloudSize + 1];
float cloudCurvature[cloudSize + 1];
float cloudDepth[cloudSize + 1];
int cloudSortInd[cloudSize + 1];
float cloudReflect[cloudSize + 1];
int reflectSortInd[cloudSize + 1];
int cloudAngle[cloudSize + 1];

PointType point;
pcl::PointCloud<PointType>::Ptr _laserCloud(new pcl::PointCloud<PointType>());
@@ -939,17 +938,16 @@ void LidarFeatureExtractor::detectFeaturePoint2(pcl::PointCloud<PointType>::Ptr&

void LidarFeatureExtractor::detectFeaturePoint3(pcl::PointCloud<PointType>::Ptr& cloud,
std::vector<int>& pointsLessSharp){
int CloudFeatureFlag[20000];
float cloudCurvature[20000];
float cloudDepth[20000];
int cloudSortInd[20000];
float cloudReflect[20000];
int reflectSortInd[20000];
int cloudAngle[20000];

pcl::PointCloud<PointType>::Ptr& laserCloudIn = cloud;

int cloudSize = laserCloudIn->points.size();
int CloudFeatureFlag[cloudSize + 1];
float cloudCurvature[cloudSize + 1];
float cloudDepth[cloudSize + 1];
int cloudSortInd[cloudSize + 1];
float cloudReflect[cloudSize + 1];
int reflectSortInd[cloudSize + 1];
int cloudAngle[cloudSize + 1];

PointType point;
pcl::PointCloud<PointType>::Ptr _laserCloud(new pcl::PointCloud<PointType>());