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

Marshal.from_string crashes on IRIX with int64 #2963

Closed
vicuna opened this issue Sep 19, 2001 · 1 comment
Closed

Marshal.from_string crashes on IRIX with int64 #2963

vicuna opened this issue Sep 19, 2001 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 19, 2001

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;;

  • : 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.

@vicuna
Copy link
Author

vicuna commented Sep 24, 2001

Comment author: administrator

Duplicate of #2962

@vicuna vicuna closed this as completed Aug 25, 2002
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant