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
Original bug ID: 534 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Marshal.from_string causes a bus error when dealing with int64 values
on IRIX64 version 6.5. The crash does not occur systematically (as you
can see in the tests below).
This problem occurs in interactive mode as well as with bytecode
and native code compiled programs.
Marshal.to_string works since the resulting string may be correctly
unmarshaled on another system (e.g i586/linux).
Test code (for interactive mode):
type t = int64
let marshal (x : t) = Marshal.to_string x []
let unmarshal s = (Marshal.from_string s 0 : t)
let s = marshal Int64.zero;;
unmarshal s;;
Result:
/tmp % ocaml
Objective Caml version 3.02
type t = int64
let marshal (x : t) = Marshal.to_string x []
let unmarshal s = (Marshal.from_string s 0 : t)
let s = marshal Int64.zero;;
type t = int64
val marshal : t -> string =
val unmarshal : string -> t =
val s : string =
"\132\149¦¾\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\018_j\000\000\000\000\000\000\000\000\000"
unmarshal s;;
: t = <int64 0>
unmarshal s;;
Bus error (core dumped)
To make the program crash with native code, I used the following code:
/tmp % cat toto.ml
type t = int64 array
let marshal (x : t) = Marshal.to_string x []
let unmarshal s = (Marshal.from_string s 0 : t)
let ar = Array.make 10000 Int64.zero
let s = marshal ar
let _ =
for i = 1 to 100 do
print_char '*';
flush stdout;
ignore (unmarshal s)
done
/tmp % ocamlopt -o toto toto.ml
/tmp % ./toto
**Bus error (core dumped)
The same result has been obtained with the bytecode compiler.
The text was updated successfully, but these errors were encountered:
Original bug ID: 534
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Martin Jambon
Version: 3.02
OS: IRIX64 6.5
Submission from: pc-bioinfo1.ibcp.fr (193.51.160.63)
Marshal.from_string causes a bus error when dealing with int64 values
on IRIX64 version 6.5. The crash does not occur systematically (as you
can see in the tests below).
This problem occurs in interactive mode as well as with bytecode
and native code compiled programs.
Marshal.to_string works since the resulting string may be correctly
unmarshaled on another system (e.g i586/linux).
Test code (for interactive mode):
type t = int64
let marshal (x : t) = Marshal.to_string x []
let unmarshal s = (Marshal.from_string s 0 : t)
let s = marshal Int64.zero;;
unmarshal s;;
Result:
/tmp % ocaml
Objective Caml version 3.02
type t = int64
let marshal (x : t) = Marshal.to_string x []
let unmarshal s = (Marshal.from_string s 0 : t)
let s = marshal Int64.zero;;
type t = int64
val marshal : t -> string =
val unmarshal : string -> t =
val s : string =
"\132\149¦¾\000\000\000\012\000\000\000\001\000\000\000\004\000\000\000\003\018_j\000\000\000\000\000\000\000\000\000"
unmarshal s;;
unmarshal s;;
Bus error (core dumped)
To make the program crash with native code, I used the following code:
/tmp % cat toto.ml
type t = int64 array
let marshal (x : t) = Marshal.to_string x []
let unmarshal s = (Marshal.from_string s 0 : t)
let ar = Array.make 10000 Int64.zero
let s = marshal ar
let _ =
for i = 1 to 100 do
print_char '*';
flush stdout;
ignore (unmarshal s)
done
/tmp % ocamlopt -o toto toto.ml
/tmp % ./toto
**Bus error (core dumped)
The same result has been obtained with the bytecode compiler.
The text was updated successfully, but these errors were encountered: