patch the correct file

spotted and fixed by Caspar Shutijs
This commit is contained in:
giovanni 2017-03-13 22:25:14 +00:00
parent cad0c0896d
commit 3cc3c32cd2
3 changed files with 43 additions and 46 deletions

View File

@ -1,10 +1,10 @@
# $OpenBSD: Makefile,v 1.11 2017/03/06 16:04:22 giovanni Exp $
# $OpenBSD: Makefile,v 1.12 2017/03/13 22:25:14 giovanni Exp $
COMMENT= multi-platform file synchronization tool
CATEGORIES= net
V= 2.48.4
REVISION= 0
REVISION= 1
DISTNAME= unison-${V}
MASTER_SITES= ${HOMEPAGE}download/releases/stable/

View File

@ -0,0 +1,41 @@
$OpenBSD: patch-bytearray_stubs_c,v 1.1 2017/03/13 22:25:14 giovanni Exp $
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 Mon May 23 18:40:05 2016
+++ bytearray_stubs.c Sun Mar 12 20:41:53 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;

View File

@ -1,44 +0,0 @@
$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;