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

[DataPoints] Added check to prevent unsigned int underflow in getEuclideanDim() #414

Merged

Conversation

YoshuaNava
Copy link
Contributor

@YoshuaNava YoshuaNava commented Oct 26, 2020

While working on deserialization of sensor_msgs/PointCloud2 to DataPoints I noticed that the function DataPoints::getEuclideanDim() can return very high values when the point cloud is empty. This happens due to unsigned type underflow.

I added a ternary expression that checks if the number of features is 0, and based on that returns 0 or the number of features minus 1.

@pomerlef pomerlef merged commit ac64995 into norlab-ulaval:master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants