From 6503680461aeeeab00455a1d8151d826df245c55 Mon Sep 17 00:00:00 2001 From: giovanni Date: Mon, 6 Mar 2017 16:04:22 +0000 Subject: [PATCH] Fix rare SIGSEGV when transferring large replicas. from Alex Markley via Davide Gerhard --- net/unison/Makefile | 3 +- .../patches/patch-patch-bytearray_stubs_c | 44 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 net/unison/patches/patch-patch-bytearray_stubs_c diff --git a/net/unison/Makefile b/net/unison/Makefile index 0aa62aca91a..cc86192afa1 100644 --- a/net/unison/Makefile +++ b/net/unison/Makefile @@ -1,9 +1,10 @@ -# $OpenBSD: Makefile,v 1.10 2016/06/27 13:34:49 giovanni Exp $ +# $OpenBSD: Makefile,v 1.11 2017/03/06 16:04:22 giovanni Exp $ COMMENT= multi-platform file synchronization tool CATEGORIES= net V= 2.48.4 +REVISION= 0 DISTNAME= unison-${V} MASTER_SITES= ${HOMEPAGE}download/releases/stable/ diff --git a/net/unison/patches/patch-patch-bytearray_stubs_c b/net/unison/patches/patch-patch-bytearray_stubs_c new file mode 100644 index 00000000000..992b2f727bf --- /dev/null +++ b/net/unison/patches/patch-patch-bytearray_stubs_c @@ -0,0 +1,44 @@ +$OpenBSD: patch-patch-bytearray_stubs_c,v 1.1 2017/03/06 16:04:22 giovanni Exp $ +--- patch-bytearray_stubs_c.orig Fri Jan 20 23:42:43 2017 ++++ patch-bytearray_stubs_c Fri Jan 20 23:42:56 2017 +@@ -0,0 +1,40 @@ ++ ++Fix rare SIGSEGV when transferring large replicas. ++Fix a theoretical integer overflow. ++ ++References: ++https://github.com/bcpierce00/unison/commit/c1ddff13aa96b124680cce61673129aeb563dbf7 ++https://github.com/bcpierce00/unison/commit/f59663d67f4593a5bc1e554058fe6864751e805e ++ ++Thanks to Alex Markley and OCaml developers ++--- bytearray_stubs.c.orig Tue Jan 17 08:41:00 2017 +++++ bytearray_stubs.c Tue Jan 17 08:41:21 2017 ++@@ -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,15 +22,18 @@ CAMLprim value ml_marshal_to_bigarray(value v, value f ++ ++ 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 ++ (value s, value i, value a, value j, value l) ++ { ++- char *src = String_val(s) + Int_val(i); +++ char *src = String_val(s) + Long_val(i); ++ char *dest = Array_data(Bigarray_val(a), j); ++ memcpy(dest, src, Long_val(l)); ++ return Val_unit;