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.to_buffer broken (Marshal.to_string ok) #3879

Closed
vicuna opened this issue Nov 20, 2005 · 1 comment
Closed

Marshal.to_buffer broken (Marshal.to_string ok) #3879

vicuna opened this issue Nov 20, 2005 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Nov 20, 2005

Original bug ID: 3879
Reporter: Jean-Marc Eber
Status: closed (set by @damiendoligez on 2005-11-22T11:51:42Z)
Resolution: fixed
Priority: normal
Severity: crash
Category: ~DO NOT USE (was: OCaml general)

Bug description

Bonjour,

Marshal.to_buffer ne fonctionne pas sous 3090. Comme nous venons de migrer de 3081, je ne sais pas exactement quand est apparu le pb (3082 ? 3083 ?...).

Le programme suivant, compilé avec ocamlc ou ocamlopt, "plante" (tant sous linux que windows), selon que l'on commente le Marshal.to_string ou non.

J'ai évidemment pensé trouver un bug trivial dans extern.c, mais ce n'est pas si simple...

Jean-Marc


let buffer = String.create 1000

(* ça "plante" si je décommente...
let _ = Marshal.to_string () [Marshal.No_sharing]
*)

let test v =
Marshal.to_buffer buffer 0 999 v [Marshal.No_sharing]

let _ = print_int (test (Some 23))


Additional information

fixed by DD 2005-11-22

@vicuna
Copy link
Author

vicuna commented Nov 22, 2005

Comment author: Jean-Marc Eber

Il faut lire:
ça "plante" si je commente... (au lieu de décommente)

En fait, en l'absence de Marshal.to_string précédant le to_buffer, ce dernier provoque un core dump ou access violation car manipule, je crois, un pointeur non initialisé dans extern.c.

Il me semble que le patch suivant règle le pb, sans que je sois sûr que cela "suffise":

$ cvs diff -r ocaml3090 extern.c
Password:
Index: extern.c

RCS file: /home/walras/lexifi/repository/mlfi/ocaml/byterun/extern.c,v
retrieving revision 1.1.1.8
diff -r1.1.1.8 extern.c
468c468,469
< extern_output_block->end = extern_ptr;

if (extern_userprovided_output == NULL)
extern_output_block->end = extern_ptr;

jm

@vicuna vicuna closed this as completed Nov 22, 2005
@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