[release-branch.go1.24] encoding/pem: properly calculate end indexes
When a block is missing the END line trailer, calculate the indexes of
the end and end trailer _before_ continuing the loop, making the
reslicing at the start of the loop work as expected.
Fixes #76028
Change-Id: If45c8cb473315623618f02cc7609f517a72d232d
Reviewed-on: https://go-review.googlesource.com/c/go/+/714200
Auto-Submit: Roland Shoemaker <roland@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit
839da71f8907ac4434299db4353db31835c916df)
Reviewed-on: https://go-review.googlesource.com/c/go/+/714680
Reviewed-by: David Chase <drchase@google.com>