]> Cypherpunks repositories - gostls13.git/commit
cmd/link: use correct length for pcln.cutab
authorIan Lance Taylor <iant@golang.org>
Mon, 29 Sep 2025 04:25:24 +0000 (21:25 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 29 Sep 2025 17:06:19 +0000 (10:06 -0700)
commitae8eba071b228dd9e05de0b0c338f3d941a0a43f
tree86fe91128615caf0103b76e6ddb3760df8b88872
parentfe3ba74b9e6e3385cbf7c2f3a9c0b72baeac4b01
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>
src/cmd/link/internal/ld/symtab.go