1
0
mirror of https://github.com/golang/go synced 2024-11-19 09:04:41 -07:00

runtime: verify hmap type size

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, khr
https://golang.org/cl/114510044
This commit is contained in:
Dmitriy Vyukov 2014-07-29 22:06:20 +04:00
parent d514e2915c
commit fe3ee5741d

View File

@ -153,8 +153,8 @@ func evacuated(b *bmap) bool {
} }
func makemap(t *maptype, hint int64) *hmap { func makemap(t *maptype, hint int64) *hmap {
if unsafe.Sizeof(hmap{}) > 48 { if sz := unsafe.Sizeof(hmap{}); sz > 48 || sz != uintptr(t.hmap.size) {
gothrow("hmap too large") gothrow("bad hmap size")
} }
if hint < 0 || int64(int32(hint)) != hint { if hint < 0 || int64(int32(hint)) != hint {