Skip to content

Commit 13a7e05

Browse files
Xstouditargos
authored andcommittedApr 22, 2020
src: check for empty maybe local
Using ToLocalChecked on MaybeLocal without verifying it's empty can lead to unattempted crash. PR-URL: #32339 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent aaf94fd commit 13a7e05

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

‎src/udp_wrap.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,8 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
477477

478478
// construct uv_buf_t array
479479
for (size_t i = 0; i < count; i++) {
480-
Local<Value> chunk = chunks->Get(env->context(), i).ToLocalChecked();
480+
Local<Value> chunk;
481+
if (!chunks->Get(env->context(), i).ToLocal(&chunk)) return;
481482

482483
size_t length = Buffer::Length(chunk);
483484

0 commit comments

Comments
 (0)
Please sign in to comment.