From 268fd979258cd044a98ca2ed4ffda18dbe78a4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Fri, 11 Mar 2022 00:48:01 +0100 Subject: [PATCH] src: remove redundant buffer size check This condition is already checked by the CHECK_BUFLEN_IN_RANGE macro, so if it was true here, that would contradict the previous check. PR-URL: https://github.com/nodejs/node/pull/42257 Reviewed-By: Rich Trott Reviewed-By: Mestery Reviewed-By: James M Snell --- src/string_bytes.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/string_bytes.cc b/src/string_bytes.cc index daff1424d22e5a..5b530c85477310 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -642,10 +642,6 @@ MaybeLocal StringBytes::Encode(Isolate* isolate, switch (encoding) { case BUFFER: { - if (buflen > node::Buffer::kMaxLength) { - *error = node::ERR_BUFFER_TOO_LARGE(isolate); - return MaybeLocal(); - } auto maybe_buf = Buffer::Copy(isolate, buf, buflen); Local buf; if (!maybe_buf.ToLocal(&buf)) {