From aa282276ecdc6fab709a98297680ce71b6af3601 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 277eb6b81bae32..770782ee9cf38e 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -516,7 +516,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);