an-cabal / an-rope

an rope data structure
https://docs.rs/an-rope
MIT License
11 stars 2 forks source link

Crash when iterating over lines of empty Rope #81

Closed juanibiapina closed 6 years ago

juanibiapina commented 6 years ago

https://github.com/an-cabal/an-rope/blob/master/src/lib.rs#L754

This lines blows up with overflow.

hawkw commented 6 years ago

Hi @juanibiapina, thanks for reporting! This line should probably be replaced with saturating arithmetic to avoid the overflow. Eventually, I think there really ought to be a large scale audit of potential overflows.