From d525f284e61f073b5399af47f76dfa1dd547021a Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sun, 28 Jul 2024 23:32:45 +0200 Subject: [PATCH] fixup --- lib/buffer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/buffer.js b/lib/buffer.js index 5411ca34aadc71..70805e9b6139cc 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -235,9 +235,6 @@ function _copy(source, target, targetStart, sourceStart, sourceEnd) { throw new ERR_OUT_OF_RANGE('sourceEnd', '>= 0', sourceEnd); } - if (targetStart >= target.length || sourceStart >= sourceEnd) - return 0; - return _copyActual(source, target, targetStart, sourceStart, sourceEnd); } @@ -250,6 +247,9 @@ function _copyActual(source, target, targetStart, sourceStart, sourceEnd) { if (nb > sourceLen) nb = sourceLen; + if (nb === 0) + return 0; + if (sourceStart !== 0 || sourceEnd < source.length) { copyArrayBuffer( target.buffer,