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

PCD read Header int32 overflow causes seg fault for big pcd binary file #2368

Closed
JD-ETH opened this issue Jul 5, 2018 · 1 comment
Closed
Labels

Comments

@JD-ETH
Copy link

JD-ETH commented Jul 5, 2018

When a pcd file has size over uint32_t max (4.2G), it is going to cause segfault when using io::loadpcd or io::loadply.

Your Environment

  • Operating System and version: Ubuntu 16.04
  • Compiler: gcc, c++ 11
  • PCL Version: current master

Context

https://github.com/PointCloudLibrary/pcl/blob/master/io/src/pcd_io.cpp#L319
this line:

int nr_points;
cloud.data.resize (nr_points * cloud.point_step);

if the multiplication causes int32 to overflow, the data is resized wrong and cause segfault in the conversion to pcl::PointCloud.

Expected Behavior

not segfault

Current Behavior

overflow causes memcopy to be less than expected

Code to Reproduce

Any Binary file exceeding 4.3 G should do.

Possible Solution

change the nr_points definition to size_t should fix it

@taketwo
Copy link
Member

taketwo commented Aug 31, 2018

Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants