mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/link: use correct length for pcln.cutab
The pcln.cutab slice holds uint32 elements, as can be seen in the runtime.moduledata type. The slice was being created with the len (and cap) set to the size of the slice, which means that the count was four times too large. This patch sets the correct len/cap. This doesn't matter for the runtime because nothing looks at the len of cutab. Since the incorrect len is larger, all valid indexes remain valid. Using the correct length means that more invalid indexes will be caught at run time, but such cases are unlikely. Still, using the correct len is less confusing. While we're here use the simpler sliceSym for pcln.pclntab. Change-Id: I09f680b3287467120d994b171c86c784085e3d27 Reviewed-on: https://go-review.googlesource.com/c/go/+/707595 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
fe3ba74b9e
commit
ae8eba071b
1 changed files with 2 additions and 2 deletions
|
|
@ -645,7 +645,7 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind {
|
||||||
sliceSym(pcln.funcnametab)
|
sliceSym(pcln.funcnametab)
|
||||||
|
|
||||||
// The cutab slice
|
// The cutab slice
|
||||||
sliceSym(pcln.cutab)
|
slice(pcln.cutab, uint64(ldr.SymSize(pcln.cutab))/4)
|
||||||
|
|
||||||
// The filetab slice
|
// The filetab slice
|
||||||
sliceSym(pcln.filetab)
|
sliceSym(pcln.filetab)
|
||||||
|
|
@ -654,7 +654,7 @@ func (ctxt *Link) symtab(pcln *pclntab) []sym.SymKind {
|
||||||
sliceSym(pcln.pctab)
|
sliceSym(pcln.pctab)
|
||||||
|
|
||||||
// The pclntab slice
|
// The pclntab slice
|
||||||
slice(pcln.pclntab, uint64(ldr.SymSize(pcln.pclntab)))
|
sliceSym(pcln.pclntab)
|
||||||
|
|
||||||
// The ftab slice
|
// The ftab slice
|
||||||
slice(pcln.pclntab, uint64(pcln.nfunc+1))
|
slice(pcln.pclntab, uint64(pcln.nfunc+1))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue