ocaml-community / lambda-term

Terminal manipulation library for OCaml
Other
209 stars 43 forks source link

Fix of_string_maybe_invalid #114

Open tuohy opened 1 year ago

tuohy commented 1 year ago

Previously this code had calls to Array.unsafe_set that would use indices beyond the range of the array being manipulated. Thankfully, Zed_string.length would throw an exception first.

Trying to allocate the array in advance does not work out if some Zed_chars are being replaced by an escape sequence with four Zed_chars.