]> Cypherpunks repositories - gostls13.git/commit
runtime: fix bad pointer with 0 stack barriers
authorAustin Clements <austin@google.com>
Mon, 24 Oct 2016 01:53:44 +0000 (21:53 -0400)
committerAustin Clements <austin@google.com>
Wed, 26 Oct 2016 15:46:25 +0000 (15:46 +0000)
commit3193c71c5b97c1e770f587f50824b266f04b71d8
treea938123ca2b37977d2521234e05cb5a9df08dc51
parentd1cc83472d611a17513795676d650276f823cafd
runtime: fix bad pointer with 0 stack barriers

Currently, if the number of stack barriers for a stack is 0, we'll
create a zero-length slice that points just past the end of the stack
allocation. This bad pointer causes GC panics.

Fix this by creating a nil slice if the stack barrier count is 0.

In practice, the only way this can happen is if
GODEBUG=gcstackbarrieroff=1 is set because even the minimum size stack
reserves space for two stack barriers.

Change-Id: I3527c9a504c445b64b81170ee285a28594e7983d
Reviewed-on: https://go-review.googlesource.com/31762
Reviewed-by: Rick Hudson <rlh@golang.org>
src/runtime/stack.go