]> Cypherpunks.ru repositories - gostls13.git/commit
[release-branch.go1.21] maps: fix aliasing problems with Clone
authorKeith Randall <khr@golang.org>
Fri, 1 Dec 2023 06:59:04 +0000 (22:59 -0800)
committerGopher Robot <gobot@golang.org>
Thu, 4 Jan 2024 21:37:00 +0000 (21:37 +0000)
commitf6b203c8281cc84b9846a550aeee40ac395274ae
tree729fd968e5620626236a570b6702f873a1d2d82f
parent43818206dc7974cb8ce080e0c5e0bce3563029f7
[release-branch.go1.21] 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 #64475

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>
(cherry picked from commit 16d3040a84be821d801b75bd1a3d8ab4cc89ee36)
Reviewed-on: https://go-review.googlesource.com/c/go/+/547375
TryBot-Bypass: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
src/maps/maps_test.go
src/runtime/map.go