Commit c8b2b725 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

runtime: fix integer overflow in hashmap

The test is problematic, because it requires 8GB+ of RAM.
Fixes #5239.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8550043
parent 77a0b96f
...@@ -451,7 +451,7 @@ hash_grow(MapType *t, Hmap *h) ...@@ -451,7 +451,7 @@ hash_grow(MapType *t, Hmap *h)
old_buckets = h->buckets; old_buckets = h->buckets;
// NOTE: this could be a big malloc, but since we don't need zeroing it is probably fast. // NOTE: this could be a big malloc, but since we don't need zeroing it is probably fast.
if(checkgc) mstats.next_gc = mstats.heap_alloc; if(checkgc) mstats.next_gc = mstats.heap_alloc;
new_buckets = runtime·mallocgc(h->bucketsize << (h->B + 1), 0, 1, 0); new_buckets = runtime·mallocgc((uintptr)h->bucketsize << (h->B + 1), 0, 1, 0);
flags = (h->flags & ~(Iterator | OldIterator)); flags = (h->flags & ~(Iterator | OldIterator));
if((h->flags & Iterator) != 0) { if((h->flags & Iterator) != 0) {
flags |= OldIterator; flags |= OldIterator;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment