diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 2fa7e89952..167bbdead6 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -403,7 +403,8 @@ Handle Buffer::Copy(const Arguments &args) { size_t target_length = Buffer::Length(target); size_t target_start = args[1]->Uint32Value(); size_t source_start = args[2]->Uint32Value(); - size_t source_end = args[3]->Uint32Value(); + size_t source_end = args[3]->IsUint32() ? args[3]->Uint32Value() + : source->length_; if (source_end < source_start) { return ThrowRangeError("sourceEnd < sourceStart");