Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006444OCamltools (ocaml{lex,yacc,dep,debug,...})public2014-05-27 15:452015-12-11 19:27
Assigned Togasche 
StatusclosedResolutionno change required 
PlatformLinuxOSArchlinuxOS VersionUp to date
Product Version4.01.0 
Target VersionFixed in Version 
Summary0006444: Ocaml toplevel segfault when using Pervasive functions
DescriptionOcaml toplevel segfault when using the code below (the last line is syntactically incorrect but trigger the crash).
Steps To Reproducelet write_sys sys file =
  let oc = Pervasives.open_out file in
  Pervasives.output_value oc sys;
  close_out oc;;

let read_sys file =
  let ic = Pervasives.open_in file in
  let sys = Pervasives.input_value ic in
  close_in ic;

write_sys (1,2) "/tmp/a";;
(read_sys "/tmp/a") (read_sys "/tmp/a");;
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (developer)
2014-05-27 15:52
edited on: 2014-05-27 15:54

input_value has a polymorphic type, and it is the programmer's responsibility to give it the correct type (the type of the value that is being read). In this example you marshall a tuple that you unmarshall as a function, and "of course" this segfaults. It is not a bug. If you want a safe (un)pickling library, you should not use Marshal or {input,output}_value.

The documentation concisely says:

> Warning: marshaling is currently not type-safe.

- Issue History
Date Modified Username Field Change
2014-05-27 15:45 Reventlov New Issue
2014-05-27 15:52 gasche Note Added: 0011577
2014-05-27 15:52 gasche Status new => resolved
2014-05-27 15:52 gasche Resolution open => no change required
2014-05-27 15:52 gasche Assigned To => gasche
2014-05-27 15:54 gasche Assigned To gasche =>
2014-05-27 15:54 gasche Status resolved => new
2014-05-27 15:54 gasche Note Edited: 0011577 View Revisions
2014-05-27 15:54 gasche Status new => resolved
2014-05-27 15:54 gasche Assigned To => gasche
2015-12-11 19:27 xleroy Status resolved => closed
2016-12-07 16:37 doligez Category OCaml tools (ocaml{lex,yacc,dep,browser,debug}) => OCaml tools (ocaml{lex,yacc,dep,debug})
2017-02-23 16:45 doligez Category OCaml tools (ocaml{lex,yacc,dep,debug}) => tools (ocaml{lex,yacc,dep,debug,...})

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker