From 13a7e0546f38f03881d286f3bd7fd0460398adb1 Mon Sep 17 00:00:00 2001 From: Xavier Stouder Date: Wed, 18 Mar 2020 08:46:40 +0100 Subject: [PATCH] src: check for empty maybe local MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/udp_wrap.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 4a66ce0a1f1018..a1f70a58e4bb03 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -477,7 +477,8 @@ void UDPWrap::DoSend(const FunctionCallbackInfo& args, int family) { // construct uv_buf_t array for (size_t i = 0; i < count; i++) { - Local chunk = chunks->Get(env->context(), i).ToLocalChecked(); + Local chunk; + if (!chunks->Get(env->context(), i).ToLocal(&chunk)) return; size_t length = Buffer::Length(chunk);