]> Cypherpunks repositories - gostls13.git/commit
reflect: audit and explain safety of all unsafe.Pointer additions
authorRuss Cox <rsc@golang.org>
Wed, 29 Nov 2017 20:22:13 +0000 (15:22 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 1 Dec 2017 21:05:40 +0000 (21:05 +0000)
commit8bb51a73e9a09c1a501c9d12f425aeb293e7d0ee
treef0254d841c50d1c9f5b0ca2634efd61e9bdfc6f8
parent662938850b6cff634a81a485c714294ccfe61fbc
reflect: audit and explain safety of all unsafe.Pointer additions

It's not safe to do p+x with unsafe if that would point past the
end of the object. (Valid in C, not safe in Go.)
Pass a "whySafe" reason (compiled away) to explain at each
call site why it's safe.

Fixes #21733.

Change-Id: I5da8c25bde66f5c9beac232f2135dcab8e8bf3b1
Reviewed-on: https://go-review.googlesource.com/80738
Reviewed-by: Austin Clements <austin@google.com>
src/reflect/export_test.go
src/reflect/swapper.go
src/reflect/type.go
src/reflect/value.go