Closed smondet closed 3 months ago
Confirming: same behavior with OCaml 5.1.0
The \000
only happens when the first character is filtered out:
let () =
let open Stdlib.Printf in
let s = " dlkjelkdje -d e E? dei !! " in
let s2 = "dlkjelkdje -d e E? dei !! " in
printf "mapi: %S\n%!" (sanitize_mapi s);
printf "mapi: %S\n%!" (sanitize_mapi s2);
printf "map: %S\n%!" (sanitize_map s2);
printf "map: %S\n%!" (sanitize_map s);
()
$ dune exec repro/main.exe
mapi: "Hello\000lkjelkdje-deEdei"
mapi: "Hellodlkjelkdje-deEdei"
Segmentation fault (core dumped)
Hi, thanks for your report! The issue should be fixed in base.v0.17.0
.
(I see a bunch of
unsafe_get
& co in the implementation so I try here before bothering ocaml/ocaml)OCaml 5.0.0, Base v0.16.3
Noticed the
[@nontail]
in the implementation ofString.filter_map
so I also triedString.filter_mapi
which does not segfault but still seems to add a\000
character (???).Reproduction:
Haven't tried with OCaml 5.1 (yet)