diff options
| author | Russ Cox <rsc@golang.org> | 2010-05-01 13:15:42 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2010-05-01 13:15:42 -0700 |
| commit | 6361f52fc4ae682e3dae3264cee1f45876272c54 (patch) | |
| tree | a65064ae7640c7a8164bf962f33c61998068ed4a /src/pkg/runtime/hashmap.c | |
| parent | 97576673bd22ab77e9ca9f9bea27f91a895ca4a2 (diff) | |
| download | go-6361f52fc4ae682e3dae3264cee1f45876272c54.tar.xz | |
gc: be pickier about slice, chan, array, and map sizes
Fixes #589.
R=ken2
CC=golang-dev
https://golang.org/cl/1032044
Diffstat (limited to 'src/pkg/runtime/hashmap.c')
| -rw-r--r-- | src/pkg/runtime/hashmap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c index f27264b682..9b039121bb 100644 --- a/src/pkg/runtime/hashmap.c +++ b/src/pkg/runtime/hashmap.c @@ -667,11 +667,14 @@ static int32 debug = 0; // makemap(key, val *Type, hint uint32) (hmap *map[any]any); Hmap* -makemap(Type *key, Type *val, uint32 hint) +makemap(Type *key, Type *val, int64 hint) { Hmap *h; int32 keyalg, valalg, keysize, valsize; + if(hint < 0 || (int32)hint != hint) + panicstring("makemap: size out of range"); + keyalg = key->alg; valalg = val->alg; keysize = key->size; @@ -731,9 +734,9 @@ makemap(Type *key, Type *val, uint32 hint) return h; } -// makemap(key, val *Type, hint uint32) (hmap *map[any]any); +// makemap(key, val *Type, hint int64) (hmap *map[any]any); void -·makemap(Type *key, Type *val, uint32 hint, Hmap *ret) +·makemap(Type *key, Type *val, int64 hint, Hmap *ret) { ret = makemap(key, val, hint); FLUSH(&ret); |
