From: Ian Lance Taylor Date: Tue, 7 Jun 2016 16:42:48 +0000 (-0700) Subject: crypto/x509: don't ignore asn1.Marshal error X-Git-Tag: go1.7beta2~12 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=53242e49b127ede6d7b258c7e90c39a5afa70c25;p=gostls13.git crypto/x509: don't ignore asn1.Marshal error I don't see how the call could fail, so, no test. Just a code cleanup in case it can fail in the future. Fixes #15987. Change-Id: If4af0d5e7d19cc8b13fb6a4f7661c37fb0015e83 Reviewed-on: https://go-review.googlesource.com/23860 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Mikio Hara --- diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go index 9e6d67df55..9ad3cf23f6 100644 --- a/src/crypto/x509/x509.go +++ b/src/crypto/x509/x509.go @@ -1796,6 +1796,9 @@ var oidExtensionRequest = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 9, 14} func newRawAttributes(attributes []pkix.AttributeTypeAndValueSET) ([]asn1.RawValue, error) { var rawAttributes []asn1.RawValue b, err := asn1.Marshal(attributes) + if err != nil { + return nil, err + } rest, err := asn1.Unmarshal(b, &rawAttributes) if err != nil { return nil, err