]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.24] encoding/pem: properly decode strange PEM data
authorRoland Shoemaker <roland@golang.org>
Wed, 15 Oct 2025 17:45:04 +0000 (10:45 -0700)
committerDavid Chase <drchase@google.com>
Fri, 24 Oct 2025 18:03:15 +0000 (11:03 -0700)
commitbbf8f423abc9f92f4c1c5d98281ed0b21107b00d
tree464a1eb424967124610f108cc9c9493c90b02564
parenta216ddc295c3e983f78a7ff911ae20ca147b09b7
[release-branch.go1.24] encoding/pem: properly decode strange PEM data

When the passed byte slice has leading garbage, properly handle ignoring
it and continuing to parse the slice until we find a valid block (or
nothing).

Fixes #75951

Change-Id: I07e937d9c754fd71b028b99450b48f57b4464457
Reviewed-on: https://go-review.googlesource.com/c/go/+/712140
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
(cherry picked from commit 09830901714d8b3a2cc5fb33e87a81886b21ea24)
Reviewed-on: https://go-review.googlesource.com/c/go/+/712641
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/encoding/pem/pem.go
src/encoding/pem/pem_test.go