-
-
Couldn't load subscription status.
- Fork 33.6k
fix: avoid external memory leak on invalid TLS protocol versions #60390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Review requested:
|
0edf2bf to
6bd1cf6
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60390 +/- ##
==========================================
- Coverage 88.59% 88.58% -0.01%
==========================================
Files 704 704
Lines 207774 207775 +1
Branches 40035 40028 -7
==========================================
- Hits 184068 184065 -3
- Misses 15748 15757 +9
+ Partials 7958 7953 -5
🚀 New features to boost your workflow:
|
|
Is it possible to add a test? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
Landed in fb84f35 |
PR-URL: #60390 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Refs #58070
Fixes a crash caused by unbalanced external memory accounting when
tls.createSecureContext()is called with invalid minVersion/maxVersion values:Stacktrace
Prior to this change,
lib/internal/tls/common.jsinstantiated a native SecureContextwhich incremented V8 external memory via
env->external_memory_accounter()->Increase(kExternalSize)incrypto_context.ccbefore protocol version validation ran in
toV(), so an earlyERR_TLS_INVALID_PROTOCOL_VERSIONthrow left the +1024 bytes un-decrementedand V8 asserted in
ExternalMemoryAccounter::~ExternalMemoryAccounterduring Environment teardown.
Fix this by reordering the constructor to validate minVersion/maxVersion first and
only allocate the native SecureContext on success.