jlblancoc / nanoflann

nanoflann: a C++11 header-only library for Nearest Neighbor (NN) search with KD-trees
Other
2.26k stars 491 forks source link

Fix middleSplit_ for same points #250

Closed yzabalotski closed 3 weeks ago

yzabalotski commented 1 month ago

While https://github.com/jlblancoc/nanoflann/pull/220 decreases amount of middleSplit_ calls, it also prevents finding correct min_elem and max_elem when max_span == 0 and span == 0. What leads to wrong cutval calculation and out of range reads at divideTree.

The issue can be observed with the unit test executed under valgrind.

jlblancoc commented 3 weeks ago

Good catch, thanks! :100: