diff options
author | Alex Markley <alex@alexmarkley.com> | 2016-12-21 21:29:15 -0500 |
---|---|---|
committer | Alex Markley <alex@alexmarkley.com> | 2016-12-21 21:29:15 -0500 |
commit | c1ddff13aa96b124680cce61673129aeb563dbf7 (patch) | |
tree | 4d5ea172763e31fabf71ef29ad08298f912baa38 /src | |
parent | 89914e4de5b621a6f808fdd9b33249e7cd893a7f (diff) | |
download | unison-c1ddff13aa96b124680cce61673129aeb563dbf7.zip unison-c1ddff13aa96b124680cce61673129aeb563dbf7.tar.gz unison-c1ddff13aa96b124680cce61673129aeb563dbf7.tar.bz2 |
Fix rare SIGSEGV when transferring large replicas.
Patch from here:
https://caml.inria.fr/mantis/view.php?id=7431#c17026
Related issue reports:
https://github.com/bcpierce00/unison/issues/48
https://caml.inria.fr/mantis/view.php?id=7431
https://bugzilla.redhat.com/show_bug.cgi?id=1401759
Diffstat (limited to 'src')
-rw-r--r-- | src/bytearray_stubs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/bytearray_stubs.c b/src/bytearray_stubs.c index ec1ed65..c1ed4ac 100644 --- a/src/bytearray_stubs.c +++ b/src/bytearray_stubs.c @@ -5,6 +5,7 @@ #include "caml/intext.h" #include "caml/bigarray.h" +#include "caml/memory.h" CAMLprim value ml_marshal_to_bigarray(value v, value flags) { @@ -21,9 +22,12 @@ CAMLprim value ml_marshal_to_bigarray(value v, value flags) CAMLprim value ml_unmarshal_from_bigarray(value b, value ofs) { + CAMLparam1(b); /* Holds [b] live until unmarshalling completes. */ + value result; struct caml_bigarray *b_arr = Bigarray_val(b); - return input_value_from_block (Array_data (b_arr, ofs), + result = input_value_from_block (Array_data (b_arr, ofs), b_arr->dim[0] - Long_val(ofs)); + CAMLreturn(result); } CAMLprim value ml_blit_string_to_bigarray |