Skip to content

Commit

Permalink
src: remove redundant buffer size check
Browse files Browse the repository at this point in the history
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: #42257
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
tniessen authored and bengl committed Mar 20, 2022
1 parent 063ff08 commit e43aa30
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/string_bytes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,6 @@ MaybeLocal<Value> StringBytes::Encode(Isolate* isolate,
switch (encoding) {
case BUFFER:
{
if (buflen > node::Buffer::kMaxLength) {
*error = node::ERR_BUFFER_TOO_LARGE(isolate);
return MaybeLocal<Value>();
}
auto maybe_buf = Buffer::Copy(isolate, buf, buflen);
Local<v8::Object> buf;
if (!maybe_buf.ToLocal(&buf)) {
Expand Down

0 comments on commit e43aa30

Please sign in to comment.