]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/runtime/map.go
runtime: fix maps.Clone bug when cloning a map mid-grow
[gostls13.git] / src / runtime / map.go
index 5d4e470b9e0b70539659b02099833dfbb2b4b568..e6d651f688380ea2647a3fca38730174f387f96d 100644 (file)
@@ -1553,7 +1553,7 @@ func mapclone2(t *maptype, src *hmap) *hmap {
                }
 
                if oldB >= dst.B { // main bucket bits in dst is less than oldB bits in src
-                       dstBmap := (*bmap)(add(dst.buckets, uintptr(i)&bucketMask(dst.B)))
+                       dstBmap := (*bmap)(add(dst.buckets, (uintptr(i)&bucketMask(dst.B))*uintptr(t.BucketSize)))
                        for dstBmap.overflow(t) != nil {
                                dstBmap = dstBmap.overflow(t)
                        }