ocaml-community / zed

Abstract engine for text edition in OCaml
Other
121 stars 16 forks source link

next_error: check if decoded value fits in Uchar #50

Closed emillon closed 1 year ago

emillon commented 1 year ago

The value can be larger than Uchar.max - in that case zed would previously return no error but functions such as explode would later raise an exception.

See ocaml-community/utop#401

emillon commented 1 year ago

Sidenote, these functions could probably use some fuzzing. In particular (has_next_error s == length s) should imply that explode s does not fail.

emillon commented 1 year ago

I can adapt the test name so that it works in CI

pmetzger commented 1 year ago

Not sure who the right person to review this would be. It looks okayish to me but I haven't checked the math in detail and it's slightly tricky.

emillon commented 1 year ago

To clarify, this does not touch the math part, it just extracts a local name for the computed value.