Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
src: fix v8 local handling in node_url.cc
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.
  • Loading branch information
addaleax committed Jan 29, 2017
commit c02f8ec09cdb65cddf0d3a5bed29578741b5084d
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