georust / rstar

R*-tree spatial index for the Rust ecosystem
https://docs.rs/rstar
Apache License 2.0
386 stars 67 forks source link

Fix panic when setting RTreeParams MIN_SIZE to 1 #93

Closed urschrei closed 2 years ago

urschrei commented 2 years ago

rstar's capacity-calculation logic would attempt to set the underlying vec's capacity to 2^64 -1 as a result, causing a panic because this exceeds the max value of isize on 64-bit platforms. This fix adds a check for MIN_SIZE = 1 when calculating capacity.

The fix currently sets the max depth to 1 – should it be higher?

Fixes #92

urschrei commented 2 years ago

Blocked on https://github.com/georust/rstar/issues/94

urschrei commented 2 years ago

bors r=rmanoka

bors[bot] commented 2 years ago

Build succeeded: