From 7360638da09bed30bb32c183c9264f7f9f0bb8c9 Mon Sep 17 00:00:00 2001 From: Tarmigan Casebolt Date: Sun, 23 Aug 2015 19:51:16 -0700 Subject: [PATCH] crypto/x509: return err if marshalPublicKey fails to marshal an rsa public key Change-Id: I9bd5c1b66fd90f0b54bd1a8f3e57b6830d2b7733 Reviewed-on: https://go-review.googlesource.com/13846 Reviewed-by: Adam Langley Run-TryBot: Adam Langley TryBot-Result: Gobot Gobot --- src/crypto/x509/x509.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/crypto/x509/x509.go b/src/crypto/x509/x509.go index be6c013464..0431f87cd0 100644 --- a/src/crypto/x509/x509.go +++ b/src/crypto/x509/x509.go @@ -56,6 +56,9 @@ func marshalPublicKey(pub interface{}) (publicKeyBytes []byte, publicKeyAlgorith N: pub.N, E: pub.E, }) + if err != nil { + return nil, pkix.AlgorithmIdentifier{}, err + } publicKeyAlgorithm.Algorithm = oidPublicKeyRSA // This is a NULL parameters value which is technically // superfluous, but most other code includes it and, by -- 2.48.1