byte_length = arr_from->byte_length;
from = &njs_typed_array_buffer(arr_from)->u.u8[arr_from->offset];
+ if (byte_length == 0) {
+ memset(to, 0, end - to);
+ return NJS_OK;
+ }
+
if (njs_typed_array_buffer(arr_from)->u.u8 == buffer->u.u8) {
while (to < end) {
n = njs_min(byte_length, (size_t) (end - to));
{ buf: Buffer.from('abc'), value: Buffer.from('def'), expected: 'def' },
{ buf: Buffer.from('abc'), value: Buffer.from('def'), detach_value: true,
exception: 'TypeError: detached buffer' },
+ { buf: Buffer.from('abc'), value: Buffer.from(''), expected: '\0\0\0' },
+ { buf: Buffer.from('abc'), value_from_buf: [1, 1], expected: '\0\0\0' },
{ buf: Buffer.from('def'),
value: Buffer.from(new Uint8Array([0x60, 0x61, 0x62, 0x63]).buffer, 1),
expected: 'abc' },