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

Overflow in pcl::octree::OctreeIteratorBase< OctreeT >::getNodeID() #1296

Closed
rhuitl opened this issue Aug 11, 2015 · 2 comments
Closed

Overflow in pcl::octree::OctreeIteratorBase< OctreeT >::getNodeID() #1296

rhuitl opened this issue Aug 11, 2015 · 2 comments

Comments

@rhuitl
Copy link
Contributor

rhuitl commented Aug 11, 2015

The method

  unsigned long pcl::octree::OctreeIteratorBase< OctreeT >::getNodeID()

is supposed to return an unsigned long (64 bit) value, however the computation is carried out with only 32 bit precision. For spatially large point clouds this results in duplicate node IDs.

The fix is simple: cast key.x, key.y and key.z to unsigned long like this:

  id = (unsigned long)key.x << (depth * 2) | (unsigned long)key.y << (depth * 1) | (unsigned long)key.z << (depth * 0);
@rhuitl
Copy link
Contributor Author

rhuitl commented Aug 12, 2015

Fixed in pull request #1297

@jspricke
Copy link
Member

merged some time ago.

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

No branches or pull requests

2 participants