From bfcf4f0046dbfdae66864e08f6c3896e6623e6fb Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 27 Nov 2022 01:48:51 -0500 Subject: [PATCH] buffer: make decodeUTF8 params loose PR-URL: https://github.com/nodejs/node/pull/45610 Reviewed-By: Anna Henningsen Reviewed-By: Darshan Sen --- src/node_buffer.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index acec3c420ce1d2..3a9aeb99a89240 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -570,6 +570,8 @@ void StringSlice(const FunctionCallbackInfo& args) { void DecodeUTF8(const FunctionCallbackInfo& 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& args) { ArrayBufferViewContents buffer(args[0]); - CHECK(args[1]->IsBoolean()); bool ignore_bom = args[1]->IsTrue(); const char* data = buffer.data();