Bug 1033492 - WebCrypto: heap-buffer-overflow crash [@PK11_EnterSlotMonitor]. r=dkeeler
authorRichard Barnes <rbarnes@mozilla.com>
Mon, 07 Jul 2014 09:07:46 -0400
changeset 192676 4c59adf6c245e82aab94f83a9b25eaa6b2132fe6
parent 192675 e65266c480e43171c997e89847114bc2a12341d5
child 192677 f81fe2b04fefb76f88bbce9952ad80112968c4f6
push idunknown
push userunknown
push dateunknown
reviewersdkeeler
bugs1033492
milestone33.0a1
Bug 1033492 - WebCrypto: heap-buffer-overflow crash [@PK11_EnterSlotMonitor]. r=dkeeler
dom/crypto/WebCryptoTask.cpp
--- a/dom/crypto/WebCryptoTask.cpp
+++ b/dom/crypto/WebCryptoTask.cpp
@@ -1392,17 +1392,17 @@ private:
     MOZ_ASSERT(slot.get());
 
     void* param;
     switch (mMechanism) {
       case CKM_RSA_PKCS_KEY_PAIR_GEN: param = &mRsaParams; break;
       default: return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
     }
 
-    SECKEYPublicKey* pubKey;
+    SECKEYPublicKey* pubKey = nullptr;
     mPrivateKey = PK11_GenerateKeyPair(slot.get(), mMechanism, param, &pubKey,
                                        PR_FALSE, PR_FALSE, nullptr);
     mPublicKey = pubKey;
     if (!mPrivateKey.get() || !mPublicKey.get()) {
       return NS_ERROR_DOM_UNKNOWN_ERR;
     }
 
     mKeyPair->PrivateKey()->SetPrivateKey(mPrivateKey);