Skip to content

Commit aa28227

Browse files
Xstoudiaddaleax
authored andcommitted
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 13377a0 commit aa28227

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
@@ -516,7 +516,8 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {
516516

517517
// construct uv_buf_t array
518518
for (size_t i = 0; i < count; i++) {
519-
Local<Value> chunk = chunks->Get(env->context(), i).ToLocalChecked();
519+
Local<Value> chunk;
520+
if (!chunks->Get(env->context(), i).ToLocal(&chunk)) return;
520521

521522
size_t length = Buffer::Length(chunk);
522523

0 commit comments

Comments
 (0)