]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/link: recompute heapPos after copyHeap
authorCherry Zhang <cherryyz@google.com>
Wed, 18 Nov 2020 00:10:51 +0000 (19:10 -0500)
committerCherry Zhang <cherryyz@google.com>
Wed, 18 Nov 2020 14:45:14 +0000 (14:45 +0000)
commitb194b5151fdac0c33da0b7359c97f92781ab3b5e
treeaa71c5475940f428d0ae25db9e6dbf343185eaa6
parent64ef84881f607c2d3a0c35762853af8f3bc4ac26
cmd/link: recompute heapPos after copyHeap

Immediately after a forward Seek, the offset we're writing to is
beyond len(buf)+len(heap):

|<--- buf --->|<--- heap --->|
                                    ^
                                    off

If we do a copyHeap at this point, the new heapPos should not be
0:

|<---------- buf ----------->|<-heap->|
                                    ^
                                    off

Recompute it.

For #42082.

Change-Id: Icb3e4e1c7bf7d1fd3d76a2e0d7dfcb319c661534
Reviewed-on: https://go-review.googlesource.com/c/go/+/270941
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/internal/ld/outbuf.go