1
0
mirror of https://github.com/golang/go synced 2024-10-03 16:31:27 -06:00
go/src/reflect
Keith Randall 6f07ac2f28 cmd/gc: pad structs which end in zero-sized fields
For a non-zero-sized struct with a final zero-sized field,
add a byte to the size (before rounding to alignment).  This
change ensures that taking the address of the zero-sized field
will not incorrectly leak the following object in memory.

reflect.funcLayout also needs this treatment.

Fixes #9401

Change-Id: I1dc503dc5af4ca22c8f8c048fb7b4541cc957e0f
Reviewed-on: https://go-review.googlesource.com/2452
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-08 21:05:10 +00:00
..
all_test.go reflect: set dir when creating a channel via ChanOf 2015-01-04 19:42:14 +00:00
asm_386.s
asm_amd64.s
asm_amd64p32.s
asm_arm.s
asm_ppc64x.s all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
deepequal.go
example_test.go
export_test.go reflect, runtime: gofmt 2014-12-26 04:43:33 +00:00
makefunc.go
set_test.go
tostring_test.go
type.go cmd/gc: pad structs which end in zero-sized fields 2015-01-08 21:05:10 +00:00
value.go reflect: add write barriers 2015-01-06 00:28:31 +00:00