summaryrefslogtreecommitdiff
path: root/src/node_buffer.cc
diff options
context:
space:
mode:
authorYagiz Nizipli <yagiz@nizipli.com>2022-11-27 01:48:51 -0500
committerGitHub <noreply@github.com>2022-11-27 06:48:51 +0000
commit60810f0da63e59b4f038e6036f6e0df0e14565f9 (patch)
treeb6075cacb22e496f3a1c10353849d51796e0a1ae /src/node_buffer.cc
parent8d0c214a8f0d0742be2b6f04b18810e29a80e1a3 (diff)
downloadnode-new-60810f0da63e59b4f038e6036f6e0df0e14565f9.tar.gz
buffer: make decodeUTF8 params loose
PR-URL: https://github.com/nodejs/node/pull/45610 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r--src/node_buffer.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index acec3c420c..3a9aeb99a8 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -570,6 +570,8 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args); // list, flags
+ CHECK_GE(args.Length(), 1);
+
if (!(args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer() ||
args[0]->IsArrayBufferView())) {
return node::THROW_ERR_INVALID_ARG_TYPE(
@@ -580,7 +582,6 @@ void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
ArrayBufferViewContents<char> buffer(args[0]);
- CHECK(args[1]->IsBoolean());
bool ignore_bom = args[1]->IsTrue();
const char* data = buffer.data();