Skip to content

Commit

Permalink
crypto: change segmentation faults to CHECKs
Browse files Browse the repository at this point in the history
PR-URL: #14548
Fixes: #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>
  • Loading branch information
tniessen authored and addaleax committed Aug 2, 2017
1 parent 87e1080 commit 51c1afa
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 51c1afa

Please sign in to comment.