From c00e70229957664cbf597da7ad5e64b49d8ab1b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Agostinho?= Date: Fri, 8 Dec 2017 13:26:50 +0000 Subject: [PATCH] Prevent POINTS field parsing before point_step is specified --- io/src/pcd_io.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/io/src/pcd_io.cpp b/io/src/pcd_io.cpp index 5b418bc56c5..85a40819e0a 100644 --- a/io/src/pcd_io.cpp +++ b/io/src/pcd_io.cpp @@ -315,6 +315,8 @@ pcl::PCDReader::readHeader (std::istream &fs, pcl::PCLPointCloud2 &cloud, // Get the number of points if (line_type.substr (0, 6) == "POINTS") { + if (!cloud.point_step) + throw "Number of POINTS specified before COUNT in header!"; sstream >> nr_points; // Need to allocate: N * point_step cloud.data.resize (nr_points * cloud.point_step);