@@ -587,9 +587,9 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
587587
588588void CopyImpl (Local<Value> source_obj,
589589 Local<Value> target_obj,
590- const uint32_t target_start,
591- const uint32_t source_start,
592- const uint32_t to_copy) {
590+ const size_t target_start,
591+ const size_t source_start,
592+ const size_t to_copy) {
593593 ArrayBufferViewContents<char > source (source_obj);
594594 SPREAD_BUFFER_ARG (target_obj, target);
595595
@@ -598,15 +598,23 @@ void CopyImpl(Local<Value> source_obj,
598598
599599// Assume caller has properly validated args.
600600void SlowCopy (const FunctionCallbackInfo<Value>& args) {
601+ Environment* env = Environment::GetCurrent (args);
601602 Local<Value> source_obj = args[0 ];
602603 Local<Value> target_obj = args[1 ];
603- const uint32_t target_start = args[2 ].As <Uint32>()->Value ();
604- const uint32_t source_start = args[3 ].As <Uint32>()->Value ();
605- const uint32_t to_copy = args[4 ].As <Uint32>()->Value ();
604+ int64_t target_start, source_start, to_copy;
605+ if (!args[2 ]->IntegerValue (env->context ()).To (&target_start) ||
606+ !args[3 ]->IntegerValue (env->context ()).To (&source_start) ||
607+ !args[4 ]->IntegerValue (env->context ()).To (&to_copy)) {
608+ return ;
609+ }
606610
607- CopyImpl (source_obj, target_obj, target_start, source_start, to_copy);
611+ CopyImpl (source_obj,
612+ target_obj,
613+ static_cast <size_t >(target_start),
614+ static_cast <size_t >(source_start),
615+ static_cast <size_t >(to_copy));
608616
609- args.GetReturnValue ().Set (to_copy);
617+ args.GetReturnValue ().Set (static_cast < double >( to_copy) );
610618}
611619
612620// Assume caller has properly validated args.
0 commit comments