Skip to content

Commit

Permalink
Merge pull request #2195 from taketwo/fix-width
Browse files Browse the repository at this point in the history
Add protection from invalid WIDTH values in PCD reader
  • Loading branch information
SergioRAgostinho committed Jan 28, 2018
2 parents 824541a + 4f884a0 commit c4abb03
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions io/src/pcd_io.cpp
Expand Up @@ -287,6 +287,8 @@ pcl::PCDReader::readHeader (std::istream &fs, pcl::PCLPointCloud2 &cloud,
if (line_type.substr (0, 5) == "WIDTH")
{
sstream >> cloud.width;
if (sstream.fail ())
throw "Invalid WIDTH value specified.";
if (cloud.point_step != 0)
cloud.row_step = cloud.point_step * cloud.width; // row_step only makes sense for organized datasets
continue;
Expand Down

0 comments on commit c4abb03

Please sign in to comment.