Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Stouder <xavier@stouder.io>2020-03-18 10:46:40 +0300
committerAnna Henningsen <anna@addaleax.net>2020-03-27 19:25:32 +0300
commit191fb3c2f29c8c5827a99258d45163b148824faf (patch)
treebe538108aef30a1d9362ff99d1b606d63ef17975 /src/udp_wrap.cc
parent1b1c2993a5bc9a64cb4d417509d2fc35a64182f4 (diff)
src: check for empty maybe local
Using ToLocalChecked on MaybeLocal without verifying it's empty can lead to unattempted crash. PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src/udp_wrap.cc')
-rw-r--r--src/udp_wrap.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index 277eb6b81ba..770782ee9cf 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -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);