Browse Source

crypto: change segmentation faults to CHECKs

PR-URL: https://github.com/nodejs/node/pull/14548
Fixes: https://github.com/nodejs/node/issues/14519
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
v6
Tobias Nießen 7 years ago
parent
commit
1c362436b7
  1. 21
      src/node_crypto.cc

21
src/node_crypto.cc

@ -5424,8 +5424,13 @@ void PBKDF2(const FunctionCallbackInfo<Value>& args) {
if (args[5]->IsFunction()) {
obj->Set(env->ondone_string(), args[5]);
if (env->in_domain())
obj->Set(env->domain_string(), env->domain_array()->Get(0));
if (env->in_domain()) {
obj->Set(env->context(),
env->domain_string(),
env->domain_array()->Get(env->context(), 0).ToLocalChecked())
.FromJust();
}
uv_queue_work(env->event_loop(),
req->work_req(),
PBKDF2Request::Work,
@ -5627,8 +5632,13 @@ void RandomBytes(const FunctionCallbackInfo<Value>& args) {
if (args[1]->IsFunction()) {
obj->Set(env->ondone_string(), args[1]);
if (env->in_domain())
obj->Set(env->domain_string(), env->domain_array()->Get(0));
if (env->in_domain()) {
obj->Set(env->context(),
env->domain_string(),
env->domain_array()->Get(env->context(), 0).ToLocalChecked())
.FromJust();
}
uv_queue_work(env->event_loop(),
req->work_req(),
RandomBytesWork,
@ -5673,7 +5683,8 @@ void RandomBytesBuffer(const FunctionCallbackInfo<Value>& args) {
if (env->in_domain()) {
obj->Set(env->context(),
env->domain_string(),
env->domain_array()->Get(0)).FromJust();
env->domain_array()->Get(env->context(), 0).ToLocalChecked())
.FromJust();
}
uv_queue_work(env->event_loop(),

Loading…
Cancel
Save