forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a crash in
Obj.reachable_words
(ocaml#10853)
A marshaling operation can leave `extern_flags` with the `NO_SHARING` bit set. In this context, `caml_obj_reachable_words` calls `extern_init_position_table`, which does nothing, then proceeds to access the position table, causing a crash. The solution is trivial: initialize `extern_flags` before calling `extern_init_position_table`. A regression test was added. First reported at ocaml-multicore/ocaml-multicore#824
- Loading branch information
1 parent
039807e
commit daf23ef
Showing
3 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(* TEST | ||
*) | ||
|
||
let _ = | ||
(* In 4.13 this causes Obj.reachable_words to segfault | ||
because of a missing initialization in caml_obj_reachable_words *) | ||
ignore (Marshal.(to_string 123 [No_sharing])); | ||
let n = Obj.reachable_words (Obj.repr (Array.init 10 (fun i -> i))) in | ||
assert (n = 11) |