]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: detect unsafe conversions from smaller to larger types
authorMatthew Dempsky <mdempsky@google.com>
Thu, 17 Oct 2019 19:06:53 +0000 (12:06 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 17 Oct 2019 19:29:20 +0000 (19:29 +0000)
commitdc72a2f95feebcfe5ccbd50636b8f8db05587d5f
tree20de26bab1c41d7934bd7cfba5cfbb2efb79c841
parent4edd78d9f8322f3627dbdc83775bf2134502a1ef
cmd/compile: detect unsafe conversions from smaller to larger types

This CL extends the runtime instrumentation for (*T)(ptr) to also
check that the first and last bytes of *(*T)(ptr) are part of the same
heap object.

Updates #22218.
Updates #34959.

Change-Id: I2c8063fe1b7fe6e6145e41c5654cb64dd1c9dd41
Reviewed-on: https://go-review.googlesource.com/c/go/+/201778
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/walk.go
src/runtime/checkptr.go