Skip to content

Commit

Permalink
src: check for empty maybe local
Browse files Browse the repository at this point in the history
Using ToLocalChecked on MaybeLocal without verifying it's empty
can lead to unattempted crash.

PR-URL: #32339
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Xstoudi authored and addaleax committed Mar 30, 2020
1 parent 13377a0 commit aa28227
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/udp_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,8 @@ void UDPWrap::DoSend(const FunctionCallbackInfo<Value>& args, int family) {

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

size_t length = Buffer::Length(chunk);

Expand Down

0 comments on commit aa28227

Please sign in to comment.