]> Cypherpunks repositories - gostls13.git/commit
runtime: repeat bitmap for slice of GCprog n-1 times, not n times
authorAustin Clements <austin@google.com>
Fri, 26 Jun 2015 21:24:12 +0000 (17:24 -0400)
committerAustin Clements <austin@google.com>
Fri, 26 Jun 2015 21:52:51 +0000 (21:52 +0000)
commitd231cb82494c59b7a5db0eb6304dcb5e5bce198f
tree0be1e811e02715280944a4781d456cc901b6f80c
parent0ea3f58db285e47810f42f98e35c802a44ce205f
runtime: repeat bitmap for slice of GCprog n-1 times, not n times

Currently, to write out the bitmap of a slice of a type with a GCprog,
we construct a new GCprog that executes the underlying type's GCprog
to write out the bitmap once and then repeats those bits n more times.
This results in n+1 repetitions of the bitmap, which is one more
repetition than it should be. This corrupts the bitmap of the heap
following the slice and may write past the mapped bitmap memory and
segfault.

Fix this by repeating the bitmap only n-1 more times.

Fixes #11430.

Change-Id: Ic24854363bffc5a755b66f257339f9309ada3aa5
Reviewed-on: https://go-review.googlesource.com/11570
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/runtime/mbitmap.go