| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 88ab61f commit 12c8773
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,7 +48,9 @@ WebCryptoCipherStatus AES_Cipher(Environment* env, | |||
| 48 | 48 | CHECK_EQ(key_data.GetKeyType(), kKeyTypeSecret); | |
| 49 | 49 | ||
| 50 | 50 | auto ctx = CipherCtxPointer::New(); | |
| 51 | - CHECK(ctx); | ||
| 51 | + if (!ctx) { | ||
| 52 | + return WebCryptoCipherStatus::FAILED; | ||
| 53 | + } | ||
| 52 | 54 | ||
| 53 | 55 | if (params.cipher.isWrapMode()) { | |
| 54 | 56 | ctx.setAllowWrap(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -222,7 +222,9 @@ WebCryptoCipherStatus ChaCha20Poly1305CipherTraits::DoCipher( | |||
| 222 | 222 | return WebCryptoCipherStatus::OK; | |
| 223 | 223 | #else | |
| 224 | 224 | auto ctx = CipherCtxPointer::New(); | |
| 225 | - CHECK(ctx); | ||
| 225 | + if (!ctx) { | ||
| 226 | + return WebCryptoCipherStatus::FAILED; | ||
| 227 | + } | ||
| 226 | 228 | ||
| 227 | 229 | const bool encrypt = cipher_mode == kWebCryptoCipherEncrypt; | |
| 228 | 230 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -73,6 +73,11 @@ void GetCipherInfo(const FunctionCallbackInfo<Value>& args) { | |||
| 73 | 73 | // If it is, then the getCipherInfo will succeed with the given | |
| 74 | 74 | // values. | |
| 75 | 75 | auto ctx = CipherCtxPointer::New(); | |
| 76 | + if (!ctx) { | ||
| 77 | + return THROW_ERR_CRYPTO_OPERATION_FAILED( | ||
| 78 | + env, "Failed to allocate cipher context"); | ||
| 79 | + } | ||
| 80 | + | ||
| 76 | 81 | if (!ctx.init(cipher, true)) { | |
| 77 | 82 | return; | |
| 78 | 83 | } | |
@@ -343,7 +348,10 @@ void CipherBase::CommonInit(const char* cipher_type, | |||
| 343 | 348 | MarkPopErrorOnReturn mark_pop_error_on_return; | |
| 344 | 349 | CHECK(!ctx_); | |
| 345 | 350 | ctx_ = CipherCtxPointer::New(); | |
| 346 | - CHECK(ctx_); | ||
| 351 | + if (!ctx_) { | ||
| 352 | + return THROW_ERR_CRYPTO_OPERATION_FAILED( | ||
| 353 | + env(), "Failed to allocate cipher context"); | ||
| 354 | + } | ||
| 347 | 355 | ||
| 348 | 356 | if (cipher.isWrapMode()) { | |
| 349 | 357 | ctx_.setAllowWrap(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments