crypto: change segmentation faults to CHECKs#14548
crypto: change segmentation faults to CHECKs#14548tniessen wants to merge 3 commits intonodejs:masterfrom
Conversation
src/node_crypto.cc
Outdated
| env->domain_string(), | ||
| env->domain_array()->Get(0)).FromJust(); | ||
| env->domain_array()->Get(env->context(), 0).ToLocalChecked()) | ||
| .FromJust(); |
There was a problem hiding this comment.
actually, indentation nit: 4 spaces ;)
src/node_crypto.cc
Outdated
| obj->Set(env->domain_string(), env->domain_array()->Get(0)); | ||
| if (env->in_domain()) { | ||
| obj->Set(env->domain_string(), | ||
| env->domain_array()->Get(env->context(), 0).ToLocalChecked()); |
There was a problem hiding this comment.
Any reason not to call .FromJust() here and below as well (à la RandomBytesBuffer())?
There was a problem hiding this comment.
I added checks to the result of Set() :)
|
This could likely benefit from a test. |
|
Landed in 1c36243.
@jasnell I considered adding one, but I was unable to cause a segmentation fault from JavaScript without using an undocumented internal API ( CI on master: https://ci.nodejs.org/job/node-test-commit-linuxone/7699/ |
|
This does not land cleanly in LTS. Please feel free to manually backport by following the guide. Please also feel free to replace do-not-land if it is being backported |
Fixes: #14519
I intentionally did not fix this in
cares_wrap.ccas @addaleax already did that in #14518 (assuming it gets merged).Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
crypto