Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make header size unconditional (Marshal) #2095

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified ocaml/boot/ocamlc
Binary file not shown.
Binary file modified ocaml/boot/ocamllex
Binary file not shown.
2 changes: 1 addition & 1 deletion ocaml/runtime4/intern.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ CAMLprim value caml_marshal_data_size(value buff, value ofs)
default:
caml_failwith("Marshal.data_size: bad object");
}
return Val_long((header_len - 20) + data_len);
return Val_long((header_len - 16) + data_len);
}

/* Resolution of code pointers */
Expand Down
5 changes: 1 addition & 4 deletions ocaml/stdlib/marshal.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ external from_channel: in_channel -> 'a = "caml_input_value"
external from_bytes_unsafe: bytes -> int -> 'a = "caml_input_value_from_bytes"
external data_size_unsafe: bytes -> int -> int = "caml_marshal_data_size"

external runtime5 : unit -> bool = "%runtime5"
let runtime5 = runtime5 ()

let header_size = if runtime5 then 16 else 20
let header_size = 16

let data_size buff ofs =
if ofs < 0 || ofs > Bytes.length buff - header_size
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Called from Callstacks.test in file "callstacks.ml", line 94, characters 2-10
Called from Stdlib__List.iter in file "list.ml", line 116, characters 12-15
Called from Callstacks in file "callstacks.ml", line 101, characters 2-27
-----------
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 70, characters 9-35
Raised by primitive operation at Stdlib__Marshal.from_bytes in file "marshal.ml", line 67, characters 9-35
Called from Callstacks.alloc_unmarshal in file "callstacks.ml", line 64, characters 12-87
Called from Callstacks.test in file "callstacks.ml", line 94, characters 2-10
Called from Stdlib__List.iter in file "list.ml", line 116, characters 12-15
Expand Down
Loading