Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a4632a3

Browse filesBrowse files
tniessenbengl
authored andcommitted
crypto: add CHECKs to remaining BIO_s_mem allocs
PR-URL: #42155 Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 19851f8 commit a4632a3
Copy full SHA for a4632a3

File tree

Expand file treeCollapse file tree

2 files changed

+9
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-0
lines changed
Open diff view settings
Collapse file

‎src/crypto/crypto_keys.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_keys.cc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,7 @@ WebCryptoKeyExportStatus PKEY_SPKI_Export(
14241424
ManagedEVPPKey m_pkey = key_data->GetAsymmetricKey();
14251425
Mutex::ScopedLock lock(*m_pkey.mutex());
14261426
BIOPointer bio(BIO_new(BIO_s_mem()));
1427+
CHECK(bio);
14271428
if (!i2d_PUBKEY_bio(bio.get(), m_pkey.get()))
14281429
return WebCryptoKeyExportStatus::FAILED;
14291430

@@ -1439,6 +1440,7 @@ WebCryptoKeyExportStatus PKEY_PKCS8_Export(
14391440
Mutex::ScopedLock lock(*m_pkey.mutex());
14401441

14411442
BIOPointer bio(BIO_new(BIO_s_mem()));
1443+
CHECK(bio);
14421444
PKCS8Pointer p8inf(EVP_PKEY2PKCS8(m_pkey.get()));
14431445
if (!i2d_PKCS8_PRIV_KEY_INFO_bio(bio.get(), p8inf.get()))
14441446
return WebCryptoKeyExportStatus::FAILED;
Collapse file

‎src/crypto/crypto_x509.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_x509.cc
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ void X509Certificate::Subject(const FunctionCallbackInfo<Value>& args) {
196196
X509Certificate* cert;
197197
ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder());
198198
BIOPointer bio(BIO_new(BIO_s_mem()));
199+
CHECK(bio);
199200
Local<Value> ret;
200201
if (GetSubject(env, bio, cert->get()).ToLocal(&ret))
201202
args.GetReturnValue().Set(ret);
@@ -206,6 +207,7 @@ void X509Certificate::Issuer(const FunctionCallbackInfo<Value>& args) {
206207
X509Certificate* cert;
207208
ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder());
208209
BIOPointer bio(BIO_new(BIO_s_mem()));
210+
CHECK(bio);
209211
Local<Value> ret;
210212
if (GetIssuerString(env, bio, cert->get()).ToLocal(&ret))
211213
args.GetReturnValue().Set(ret);
@@ -216,6 +218,7 @@ void X509Certificate::SubjectAltName(const FunctionCallbackInfo<Value>& args) {
216218
X509Certificate* cert;
217219
ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder());
218220
BIOPointer bio(BIO_new(BIO_s_mem()));
221+
CHECK(bio);
219222
Local<Value> ret;
220223
if (GetSubjectAltNameString(env, bio, cert->get()).ToLocal(&ret))
221224
args.GetReturnValue().Set(ret);
@@ -226,6 +229,7 @@ void X509Certificate::InfoAccess(const FunctionCallbackInfo<Value>& args) {
226229
X509Certificate* cert;
227230
ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder());
228231
BIOPointer bio(BIO_new(BIO_s_mem()));
232+
CHECK(bio);
229233
Local<Value> ret;
230234
if (GetInfoAccessString(env, bio, cert->get()).ToLocal(&ret))
231235
args.GetReturnValue().Set(ret);
@@ -236,6 +240,7 @@ void X509Certificate::ValidFrom(const FunctionCallbackInfo<Value>& args) {
236240
X509Certificate* cert;
237241
ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder());
238242
BIOPointer bio(BIO_new(BIO_s_mem()));
243+
CHECK(bio);
239244
Local<Value> ret;
240245
if (GetValidFrom(env, cert->get(), bio).ToLocal(&ret))
241246
args.GetReturnValue().Set(ret);
@@ -246,6 +251,7 @@ void X509Certificate::ValidTo(const FunctionCallbackInfo<Value>& args) {
246251
X509Certificate* cert;
247252
ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder());
248253
BIOPointer bio(BIO_new(BIO_s_mem()));
254+
CHECK(bio);
249255
Local<Value> ret;
250256
if (GetValidTo(env, cert->get(), bio).ToLocal(&ret))
251257
args.GetReturnValue().Set(ret);
@@ -325,6 +331,7 @@ void X509Certificate::Pem(const FunctionCallbackInfo<Value>& args) {
325331
X509Certificate* cert;
326332
ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder());
327333
BIOPointer bio(BIO_new(BIO_s_mem()));
334+
CHECK(bio);
328335
if (PEM_write_bio_X509(bio.get(), cert->get()))
329336
args.GetReturnValue().Set(ToV8Value(env, bio));
330337
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.