You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let open Examples.Api.Builder in
let p = Payload.init_root () in
let content = Payload.content_get p in
Payload.cap_table_init p 1 |> ignore;
TestArgs.params_init content 1 |> ignore;
Alcotest.(check int) "Args len aa" 1 (Capnp.Array.length (TestArgs.params_get content));
Payload.cap_table_init p 1 |> ignore;
Alcotest.(check int) "Args len bb" 1 (Capnp.Array.length (TestArgs.params_get content))
(* Composite lists prefix the data with a tag word, so clean up
the tag word along with everything else *)
let content_slice = {
list_storage.storage with
RWM.Slice.start = list_storage.storage.RWM.Slice.start - sizeof_uint64;
RWM.Slice.len = list_storage.storage.RWM.Slice.len + sizeof_uint64;
} in
RWM.Slice.zero_out content_slice ~pos:0 ~len:content_slice.RWM.Slice.len
By contrast, alloc_list_storage appears to return a slice that includes the tag.
This means that whatever happens to be stored just before the list gets zeroed out.
Possibly it also fails to zero the list properly.
The text was updated successfully, but these errors were encountered:
Test case:
With schema (simplfied from an RPC system):
The second assertion fails: the second call to
cap_table_init
zeroes out the last element ofparams
.Stepping through with ocamldebug, it seems the problem is at https://github.com/pelzlpj/capnp-ocaml/blob/f711ece828a5a662569c68d048671390d7fb1862/src/runtime/builderOps.ml#L834:
By contrast,
alloc_list_storage
appears to return a slice that includes the tag.This means that whatever happens to be stored just before the list gets zeroed out.
Possibly it also fails to zero the list properly.
The text was updated successfully, but these errors were encountered: