crypto,quic: add NULL checks for OpenSSL allocation functions#63040
Open
armorbreak001 wants to merge 2 commits into
Open
crypto,quic: add NULL checks for OpenSSL allocation functions#63040armorbreak001 wants to merge 2 commits into
armorbreak001 wants to merge 2 commits into
Conversation
Collaborator
|
Review requested:
|
234ce29 to
78ab09a
Compare
jasnell
approved these changes
May 4, 2026
78ab09a to
cb76fb6
Compare
Collaborator
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63040 +/- ##
==========================================
+ Coverage 89.65% 90.06% +0.41%
==========================================
Files 708 714 +6
Lines 220402 225518 +5116
Branches 42269 42645 +376
==========================================
+ Hits 197597 203110 +5513
+ Misses 14671 14198 -473
- Partials 8134 8210 +76
🚀 New features to boost your workflow:
|
Replace CHECK() assertions with graceful error handling for EVP_CIPHER_CTX_new() allocations that could fail under memory pressure: - crypto_aes.cc (AES_Cipher): return FAILED status - crypto_cipher.cc (CommonInit): throw JS error via ThrowCryptoError Fixes nodejs#62774 Signed-off-by: armorbreak001 <contact@agentvote.cc>
cb76fb6 to
3899839
Compare
Signed-off-by: armorbreak001 <contact@agentvote.cc>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #62774
This PR adds graceful NULL checks for OpenSSL allocation function return values, replacing
CHECK()assertions that would abort the process on allocation failure.Changes
src/crypto/crypto_aes.cc—AES_Cipher()Replaced
CHECK(ctx)with:This matches the pattern already used in
AES_CTR_Cipher2()in the same file.src/crypto/crypto_cipher.cc—CipherBase::CommonInit()Replaced
CHECK(ctx_)with:This matches the error handling pattern used elsewhere in the same function.
Note on other locations from #62774
AES_CTR_Cipher2()— Already has a properif (!ctx)check (line 238)TLSSession::Initialize()— Already has a properif (!ssl)check (line 794)ECKeyExportTraits::DoExport()— This function no longer exists in the current codebase; the EC key handling code has been refactored