Skip to content

Commit

Permalink
src: fix v8 local handling in node_url.cc
Browse files Browse the repository at this point in the history
Calling `.As<Object>()` on a non-object aborts in debug mode,
but `node_url.cc` relied on it. Address that by using `Local<Value>`
until it has been confirmed that the handle actually is an object.

PR-URL: #11064
Reviewed-By: Michal Zasso <[email protected]>
Reviewed-By: Timothy Gu <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
addaleax authored and evanlucas committed Jan 31, 2017
1 parent 65691d6 commit a24264e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,8 @@ namespace url {
const char* input,
const size_t len,
enum url_parse_state override,
Local<Object> base_obj,
Local<Object> context_obj,
Local<Value> base_obj,
Local<Value> context_obj,
Local<Function> cb) {
Isolate* isolate = env->isolate();
Local<Context> context = env->context();
Expand All @@ -654,9 +654,9 @@ namespace url {
struct url_data base;
struct url_data url;
if (context_obj->IsObject())
HarvestContext(env, &url, context_obj);
HarvestContext(env, &url, context_obj.As<Object>());
if (has_base)
HarvestBase(env, &base, base_obj);
HarvestBase(env, &base, base_obj.As<Object>());

std::string buffer;
url.scheme.reserve(len);
Expand Down Expand Up @@ -1321,8 +1321,8 @@ namespace url {
Parse(env, args.This(),
*input, input.length(),
override,
args[2].As<Object>(),
args[3].As<Object>(),
args[2],
args[3],
args[4].As<Function>());
}

Expand Down

0 comments on commit a24264e

Please sign in to comment.