Skip to content

crypto/x509: CreateCertificate can panic in asn1 code #16603

Description

@jefferai

Please answer these questions before submitting your issue. Thanks!

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

go version go1.7rc4 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/jeff/go"
GORACE=""
GOROOT="/home/jeff/src/go"
GOTOOLDIR="/home/jeff/src/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build022291271=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

(3) What did you do?

https://play.golang.org/p/P68H4kx8AF

Created a self-signed certificate. This goes away if I set a SerialNumber on the template. The documentation says that SerialNumber will be used from the template, but not that it is required (so it's reasonable to think that it may be randomly chosen if not set). Either way, I'd argue that there should be a check to detect this and return an error, rather than an undocumented panic situation.

(4) What did you expect to see?

An error.

(5) What did you see instead?

A panic.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions