diff options
author | Tobias Nießen <tniessen@tnie.de> | 2017-04-12 21:57:28 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-04-15 00:02:45 +0300 |
commit | 88aab45c92578b78afc355002fb195301af7a993 (patch) | |
tree | 70a9dd171529c351c3c3d651513dcd1ef7028d65 /src/node_os.cc | |
parent | 9d522225e7907b6cf631975b34f586984f698e33 (diff) |
os,vm: fix segfaults and CHECK failure
Fixes multiple possible segmentation faults in node_contextify.cc and
an assertion failure in node_os.cc
Fixes: https://github.com/nodejs/node/issues/12369
Fixes: https://github.com/nodejs/node/issues/12370
PR-URL: https://github.com/nodejs/node/pull/12371
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_os.cc')
-rw-r--r-- | src/node_os.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/node_os.cc b/src/node_os.cc index d7be9095b17..fad19469532 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -57,6 +57,7 @@ using v8::Function; using v8::FunctionCallbackInfo; using v8::Integer; using v8::Local; +using v8::MaybeLocal; using v8::Null; using v8::Number; using v8::Object; @@ -339,7 +340,12 @@ static void GetUserInfo(const FunctionCallbackInfo<Value>& args) { if (args[0]->IsObject()) { Local<Object> options = args[0].As<Object>(); - Local<Value> encoding_opt = options->Get(env->encoding_string()); + MaybeLocal<Value> maybe_encoding = options->Get(env->context(), + env->encoding_string()); + if (maybe_encoding.IsEmpty()) + return; + + Local<Value> encoding_opt = maybe_encoding.ToLocalChecked(); encoding = ParseEncoding(env->isolate(), encoding_opt, UTF8); } else { encoding = UTF8; |