From 3d5eba80423944cacf93cb960cf3b9a573801c0c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 30 Sep 2021 23:13:32 +0200 Subject: [PATCH] lib: refactor to avoid unsafe array iteration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/40271 Reviewed-By: Rich Trott Reviewed-By: Juan José Arboleda Reviewed-By: Benjamin Gruenbaum --- lib/internal/v8_prof_processor.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/internal/v8_prof_processor.js b/lib/internal/v8_prof_processor.js index ddfafca64c45f0..4ed6fe8b9b3902 100644 --- a/lib/internal/v8_prof_processor.js +++ b/lib/internal/v8_prof_processor.js @@ -2,6 +2,7 @@ const { ArrayPrototypePush, + ArrayPrototypePushApply, ArrayPrototypeSlice, StringPrototypeSlice, } = primordials; @@ -27,8 +28,8 @@ async function linker(specifier, referencingModule) { } else if (process.platform === 'win32') { ArrayPrototypePush(tickArguments, '--windows'); } - ArrayPrototypePush(tickArguments, - ...ArrayPrototypeSlice(process.argv, 1)); + ArrayPrototypePushApply(tickArguments, + ArrayPrototypeSlice(process.argv, 1)); const context = vm.createContext({ arguments: tickArguments,