Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: net/base/x509_certificate_win.cc

Issue 10879097: Merge 153220 - net: don't crash when processing a certificate with an unknown public key. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1229/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/x509_certificate_openssl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_certificate_win.cc
===================================================================
--- net/base/x509_certificate_win.cc (revision 153489)
+++ net/base/x509_certificate_win.cc (working copy)
@@ -428,13 +428,19 @@
void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle,
size_t* size_bits,
PublicKeyType* type) {
+ *type = kPublicKeyTypeUnknown;
+ *size_bits = 0;
+
PCCRYPT_OID_INFO oid_info = CryptFindOIDInfo(
CRYPT_OID_INFO_OID_KEY,
cert_handle->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId,
CRYPT_PUBKEY_ALG_OID_GROUP_ID);
- PCHECK(oid_info);
- CHECK(oid_info->dwGroupId == CRYPT_PUBKEY_ALG_OID_GROUP_ID);
+ if (!oid_info)
+ return;
+ CHECK_EQ(oid_info->dwGroupId,
+ static_cast<DWORD>(CRYPT_PUBKEY_ALG_OID_GROUP_ID));
+
*size_bits = CertGetPublicKeyLength(
X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
&cert_handle->pCertInfo->SubjectPublicKeyInfo);
@@ -453,10 +459,6 @@
case CALG_ECDH:
*type = kPublicKeyTypeECDH;
break;
- default:
- *type = kPublicKeyTypeUnknown;
- *size_bits = 0;
- break;
}
}
« no previous file with comments | « net/base/x509_certificate_openssl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698