Skip to content
This repository was archived by the owner on Dec 30, 2023. It is now read-only.

Commit 6c1bc31

Browse files
committed
exception for resolution <= 0 in OctreePointCloud c'tor
Used to trigger a C assert/abort in PCL 1.7.1.
1 parent 200dae6 commit 6c1bc31

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pcl/_pcl.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ cdef class OctreePointCloud:
571571
"""
572572
Constructs octree pointcloud with given resolution at lowest octree level
573573
"""
574+
if resolution <= 0.:
575+
raise ValueError("Expected resolution > 0., got %r" % resolution)
574576
self.me = new cpp.OctreePointCloud_t(resolution)
575577

576578
def __dealloc__(self):

tests/test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ def setUp(self):
326326
self.t.define_bounding_box()
327327
self.t.add_points_from_input_cloud()
328328

329+
def testConstructor(self):
330+
self.assertRaises(ValueError, pcl.OctreePointCloudSearch, 0.)
331+
329332
def testRadiusSearch(self):
330333
good_point = (0.035296999, -0.074322999, 1.2074)
331334
rs = self.t.radius_search(good_point, 0.5, 1)

0 commit comments

Comments
 (0)