mirage/ocaml-cstruct

Enormous exceptions

Closed this issue · 0 comments

djs55 commented

I'm getting ever bigger Cstruct exception strings. In utop:

utop # require "cstruct";;
utop # let c = Cstruct.create 1;;
val c : Cstruct.t = {Cstruct.buffer = <abstr>; off = 0; len = 1} 
utop # let c' = Cstruct.sub c 5 6;;
Exception: Invalid_argument "Cstruct.sub: [0,1](1) off=5 len=6".
utop # let c' = Cstruct.sub c 5 6;;
Exception: Invalid_argument "Cstruct.sub: [0,1](1) off=5 len=6Cstruct.sub: [0,1](1) off=5 len=6". 
utop # let c' = Cstruct.sub c 5 6;;
Exception: Invalid_argument "Cstruct.sub: [0,1](1) off=5 len=6Cstruct.sub: [0,1](1) off=5 len=6Cstruct.sub: [0,1](1) off=5 len=6"

This is in version:

$ ocamlfind list | grep cstruct
cstruct             (version: 2.3.0)

Presumably this is a mishandling of buffers in the formatting code?