]> Cypherpunks repositories - gostls13.git/commit
runtime: hashmap: move overflow pointer to end of bucket
authorKeith Randall <khr@golang.org>
Sat, 20 Dec 2014 04:44:18 +0000 (20:44 -0800)
committerKeith Randall <khr@golang.org>
Mon, 22 Dec 2014 22:25:48 +0000 (22:25 +0000)
commitfbc56cf05015899aba236d5a68096a770de3ad0a
tree44d489f2452644d208643db8fc19fe566b15a409
parentaaa4bf3720bbf69e1ac65414448baf88b5e4cd83
runtime: hashmap: move overflow pointer to end of bucket

Pointers to zero-sized values may end up pointing to the next
object in memory, and possibly off the end of a span.  This
can cause memory leaks and/or confuse the garbage collector.

By putting the overflow pointer at the end of the bucket, we
make sure that pointers to any zero-sized keys or values don't
accidentally point to the next object in memory.

fixes #9384

Change-Id: I5d434df176984cb0210b4d0195dd106d6eb28f73
Reviewed-on: https://go-review.googlesource.com/1869
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/gc/reflect.c
src/cmd/ld/dwarf.c
src/reflect/type.go
src/runtime/hashmap.go
src/runtime/hashmap_fast.go