]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.25] 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:02 +0000 (11:03 -0700)
commit7e049e5c3143153fd135864b94b6d417f9e6c2a5
treea4ba350e76b1a7b5e88a15799c41522142ff6d96
parentf6db7350e1287c1d3570b182756cc75f5c7789fe
[release-branch.go1.25] 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 #75952

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/+/712640
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
src/encoding/pem/pem.go
src/encoding/pem/pem_test.go