Skip to content

Commit a24264e

Browse files
addaleaxevanlucas
authored andcommitted
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. 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]>
1 parent 65691d6 commit a24264e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/node_url.cc

+6-6
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ namespace url {
636636
const char* input,
637637
const size_t len,
638638
enum url_parse_state override,
639-
Local<Object> base_obj,
640-
Local<Object> context_obj,
639+
Local<Value> base_obj,
640+
Local<Value> context_obj,
641641
Local<Function> cb) {
642642
Isolate* isolate = env->isolate();
643643
Local<Context> context = env->context();
@@ -654,9 +654,9 @@ namespace url {
654654
struct url_data base;
655655
struct url_data url;
656656
if (context_obj->IsObject())
657-
HarvestContext(env, &url, context_obj);
657+
HarvestContext(env, &url, context_obj.As<Object>());
658658
if (has_base)
659-
HarvestBase(env, &base, base_obj);
659+
HarvestBase(env, &base, base_obj.As<Object>());
660660

661661
std::string buffer;
662662
url.scheme.reserve(len);
@@ -1321,8 +1321,8 @@ namespace url {
13211321
Parse(env, args.This(),
13221322
*input, input.length(),
13231323
override,
1324-
args[2].As<Object>(),
1325-
args[3].As<Object>(),
1324+
args[2],
1325+
args[3],
13261326
args[4].As<Function>());
13271327
}
13281328

0 commit comments

Comments
 (0)