Skip to content
Permalink
Browse files

fix PR#7003 and a few other bugs caused by misuse of Int_val

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@16525 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information...
Damien Doligez
Damien Doligez committed Oct 19, 2015
1 parent c9f0dc9 commit 659615c7b100a89eafe6253e7a5b9d84d0e8df74
Showing with 9 additions and 7 deletions.
  1. +3 −1 Changes
  2. +1 −1 VERSION
  3. +2 −2 byterun/alloc.c
  4. +1 −1 byterun/intern.c
  5. +2 −2 byterun/str.c
@@ -204,8 +204,10 @@ Bug fixes:
%s#row when Bar contains private row types
- PR#6992: Segfault from bug in GADT/module typing
- PR#6993: Segfault from recursive modules violating exhaustiveness assumptions
- PR#7003: String.sub causes segmentation fault
(Damien Doligez, report by Radek Micek)
- PR#7008: Fatal error in ocamlc with empty compilation unit name
(Damien Doligez)
(Damien Doligez, report by Cesar Kunz)
- PR#7012: Variable name forgotten when it starts with a capital letter
(Jacques Garrigue, Gabriel Scherer, report by Thomas Leonard and Octachron)
- PR#7016: Stack overflow in GADT typing
@@ -1,4 +1,4 @@
4.03.0+dev10-2015-07-29
4.03.0+dev11-2015-10-19

# The version string is the first line of this file.
# It must be in the format described in stdlib/sys.mli
@@ -153,7 +153,7 @@ CAMLexport int caml_convert_flag_list(value list, int *flags)
/* [size] is a [value] representing number of words (fields) */
CAMLprim value caml_alloc_dummy(value size)
{
mlsize_t wosize = Int_val(size);
mlsize_t wosize = Long_val(size);

if (wosize == 0) return Atom(0);
return caml_alloc (wosize, 0);
@@ -169,7 +169,7 @@ CAMLprim value caml_alloc_dummy_function(value size,value arity)
/* [size] is a [value] representing number of floats. */
CAMLprim value caml_alloc_dummy_float (value size)
{
mlsize_t wosize = Int_val(size) * Double_wosize;
mlsize_t wosize = Long_val(size) * Double_wosize;

if (wosize == 0) return Atom(0);
return caml_alloc (wosize, 0);
@@ -291,7 +291,7 @@ static void intern_rec(value *dest)
case OFreshOID:
/* Refresh the object ID */
/* but do not do it for predefined exception slots */
if (Int_val(Field((value)dest, 1)) >= 0)
if (Long_val(Field((value)dest, 1)) >= 0)
caml_set_oo_id((value)dest);
/* Pop item and iterate */
sp--;
@@ -266,7 +266,7 @@ CAMLprim value caml_string_greaterequal(value s1, value s2)
CAMLprim value caml_blit_string(value s1, value ofs1, value s2, value ofs2,
value n)
{
memmove(&Byte(s2, Long_val(ofs2)), &Byte(s1, Long_val(ofs1)), Int_val(n));
memmove(&Byte(s2, Long_val(ofs2)), &Byte(s1, Long_val(ofs1)), Long_val(n));
return Val_unit;
}

@@ -278,7 +278,7 @@ CAMLprim value caml_fill_string(value s, value offset, value len, value init)

CAMLprim value caml_bitvect_test(value bv, value n)
{
int pos = Int_val(n);
intnat pos = Long_val(n);
return Val_int(Byte_u(bv, pos >> 3) & (1 << (pos & 7)));
}

1 comment on commit 659615c

@pascal-cuoq

This comment has been minimized.

Copy link

commented on 659615c Oct 28, 2015

We have just independently encountered the caml_blit_string part of this issue, and a fix is already available nine days ago. Great job!

Please sign in to comment.
You can’t perform that action at this time.