]> Cypherpunks.ru repositories - gostls13.git/commit
maps: fix aliasing problems with Clone
authorKeith Randall <khr@golang.org>
Fri, 1 Dec 2023 06:59:04 +0000 (22:59 -0800)
committerKeith Randall <khr@golang.org>
Tue, 5 Dec 2023 17:05:56 +0000 (17:05 +0000)
commit16d3040a84be821d801b75bd1a3d8ab4cc89ee36
tree68d04d9721fac23f811f34200c150385d0b948e6
parent098f059d077d01d9151e2e76901f62a7f2d52fec
maps: fix aliasing problems with Clone

Make sure to alloc+copy large keys and values instead of aliasing them,
when they might be updated by a future assignment.

Fixes #64474

Change-Id: Ie2226a81cf3897e4e2ee24472f2966d397ace53f
Reviewed-on: https://go-review.googlesource.com/c/go/+/546515
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
src/maps/maps_test.go
src/runtime/map.go