diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2014-04-28 11:49:52 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2014-04-28 11:49:52 +0000 |
commit | cc25e53ad310eb32d4854a1505ac3a9a917c8368 (patch) | |
tree | 101a8f24490f8ef63c75820cfd945cc4d7f669fc /byterun/hash.c | |
parent | e94190206fe983154d5606a448e434aec03783d0 (diff) | |
parent | f1f362698f931494a305d48667936ffee2012b64 (diff) | |
download | ocaml-safe-string.tar.gz |
merge trunk up to commit 14699safe-string
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/safe-string@14700 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'byterun/hash.c')
-rw-r--r-- | byterun/hash.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/byterun/hash.c b/byterun/hash.c index 3beb0e016e..42cf613738 100644 --- a/byterun/hash.c +++ b/byterun/hash.c @@ -213,7 +213,7 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj) for (i = 0, len = Wosize_val(v) / Double_wosize; i < len; i++) { h = caml_hash_mix_double(h, Double_field(v, i)); num--; - if (num < 0) break; + if (num <= 0) break; } break; case Abstract_tag: @@ -227,6 +227,9 @@ CAMLprim value caml_hash(value count, value limit, value seed, value obj) goto again; case Forward_tag: v = Forward_val(v); + /* PR#6361: this should count as 1, otherwise we can get into a loop */ + num--; + if (num <= 0) break; goto again; case Object_tag: h = caml_hash_mix_intnat(h, Oid_val(v)); |