Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 02b432a

Browse filesBrowse files
addaleaxrichardlau
authored andcommitted
src: fix crash in AfterGetAddrInfo
Remove invalid usage of `Check()`. This addresses: FATAL ERROR: v8::FromJust Maybe value is Nothing. 1: 0x101311bf5 node::Abort() (.cold.1) [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 2: 0x1000ade29 node::Abort() [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 3: 0x1000adf8f node::OnFatalError(char const*, char const*) [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 4: 0x1001f42d0 v8::V8::FromJustIsNothing() [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 5: 0x1000268e2 node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*)::$_2::operator()(bool, bool) const [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 6: 0x10002657c node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*) [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 7: 0x1009fb388 uv__work_done [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 8: 0x100a00453 uv__async_io [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 9: 0x100a140cc uv__io_poll [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 10: 0x100a009c1 uv_run [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 11: 0x10014aca0 node::worker::Worker::Run() [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 12: 0x10014e56f node::worker::Worker::StartThread(v8::FunctionCallbackInfo<v8::Value> const&)::$_3::__invoke(void*) [/Users/xxx/.nvm/versions/node/v14.17.4/bin/node] 13: 0x7fff703d42eb _pthread_body [/usr/lib/system/libsystem_pthread.dylib] 14: 0x7fff703d7249 _pthread_start [/usr/lib/system/libsystem_pthread.dylib] 15: 0x7fff703d340d thread_start [/usr/lib/system/libsystem_pthread.dylib] PR-URL: #39735 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 41e09ec commit 02b432a
Copy full SHA for 02b432a

File tree

Expand file treeCollapse file tree

1 file changed

+13
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-5
lines changed
Open diff view settings
Collapse file

‎src/cares_wrap.cc‎

Copy file name to clipboardExpand all lines: src/cares_wrap.cc
+13-5Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ using v8::HandleScope;
6161
using v8::Int32;
6262
using v8::Integer;
6363
using v8::Isolate;
64+
using v8::Just;
6465
using v8::Local;
66+
using v8::Maybe;
6567
using v8::NewStringType;
68+
using v8::Nothing;
6669
using v8::Null;
6770
using v8::Object;
6871
using v8::String;
@@ -1831,7 +1834,7 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
18311834
if (status == 0) {
18321835
Local<Array> results = Array::New(env->isolate());
18331836

1834-
auto add = [&] (bool want_ipv4, bool want_ipv6) {
1837+
auto add = [&] (bool want_ipv4, bool want_ipv6) -> Maybe<bool> {
18351838
for (auto p = res; p != nullptr; p = p->ai_next) {
18361839
CHECK_EQ(p->ai_socktype, SOCK_STREAM);
18371840

@@ -1851,14 +1854,19 @@ void AfterGetAddrInfo(uv_getaddrinfo_t* req, int status, struct addrinfo* res) {
18511854
continue;
18521855

18531856
Local<String> s = OneByteString(env->isolate(), ip);
1854-
results->Set(env->context(), n, s).Check();
1857+
if (results->Set(env->context(), n, s).IsNothing())
1858+
return Nothing<bool>();
18551859
n++;
18561860
}
1861+
return Just(true);
18571862
};
18581863

1859-
add(true, verbatim);
1860-
if (verbatim == false)
1861-
add(false, true);
1864+
if (add(true, verbatim).IsNothing())
1865+
return;
1866+
if (verbatim == false) {
1867+
if (add(false, true).IsNothing())
1868+
return;
1869+
}
18621870

18631871
// No responses were found to return
18641872
if (n == 0) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.