Skip to content

Commit fc02232

Browse files
anonrigErickWendel
authored andcommitted
buffer: make decodeUTF8 params loose
PR-URL: nodejs#45610 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 8511b68 commit fc02232

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/node_buffer.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,8 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
570570
void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
571571
Environment* env = Environment::GetCurrent(args); // list, flags
572572

573+
CHECK_GE(args.Length(), 1);
574+
573575
if (!(args[0]->IsArrayBuffer() || args[0]->IsSharedArrayBuffer() ||
574576
args[0]->IsArrayBufferView())) {
575577
return node::THROW_ERR_INVALID_ARG_TYPE(
@@ -580,7 +582,6 @@ void DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
580582

581583
ArrayBufferViewContents<char> buffer(args[0]);
582584

583-
CHECK(args[1]->IsBoolean());
584585
bool ignore_bom = args[1]->IsTrue();
585586

586587
const char* data = buffer.data();

0 commit comments

Comments
 (0)