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

Segfault when saving index built from empty array #205

Closed
h4k1m0u opened this issue Jun 15, 2023 · 1 comment
Closed

Segfault when saving index built from empty array #205

h4k1m0u opened this issue Jun 15, 2023 · 1 comment

Comments

@h4k1m0u
Copy link

h4k1m0u commented Jun 15, 2023

Not sure if it's the expected behavior of nanoflann and since it wasn't mentioned in the docs, I thought it was worth raising up this issue.
I pass 3D point coordinates to nanoflann to construct the kdtree index (distance = L2). When the number of points is = 0 and I try to save the index, I get a segfault from the second line in the following:

std::ofstream file_kdtree(path_kdtree, std::ofstream::binary);
index.saveIndex(file_kdtree);

To avoid the segfault, I don't call m_index.saveIndex() unless index.m_size > 0.

@h4k1m0u h4k1m0u changed the title Segfault when saving index built from empty array as input Segfault when saving index built from empty array Jun 15, 2023
@jlblancoc
Copy link
Owner

Indeed, it was a bug. Fixed now, thanks!

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