Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/pem: Decode method uses extensive CPU when providing large data #50116

Open
naveensrinivasan opened this issue Dec 12, 2021 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Milestone

Comments

@naveensrinivasan
Copy link

What version of Go are you using (go version)?

$ go version
17.5

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/home/sammy/go/bin"
GOCACHE="/home/sammy/.cache/go-build"
GOENV="/home/sammy/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/sammy/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/sammy/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/nix/store/i8x0bv8v69j8c2njymgs4cl3albqc20h-go-1.17.5/share/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/nix/store/i8x0bv8v69j8c2njymgs4cl3albqc20h-go-1.17.5/share/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.5"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/run/user/1000/go-build3984378223=/tmp/go-build -gno-record-gcc-switches"

What did you do?

As part of fuzz testing sigstore/sigstore#188 using oss-fuzz we ran into an issue where the pem.Decode is consuming extensive CPU and here is the test case for it https://github.com/sigstore/sigstore/files/7676542/clusterfuzz-testcase-minimized-FuzzUnmarshalCertificatesFromPEM-4710187355734016.zip

What did you expect to see?

The pem.Decode finishing sooner than it consumes large amount of CPU

What did you see instead?

It being slow

@cherrymui cherrymui added Performance NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Dec 13, 2021
@cherrymui cherrymui added this to the Backlog milestone Dec 13, 2021
@cherrymui
Copy link
Member

cc @rsc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Projects
None yet
Development

No branches or pull requests

2 participants