From dc38dd2c6fa2af3fd423d88092c7f31b00a28e6b Mon Sep 17 00:00:00 2001 From: Darshan Sen Date: Thu, 4 Feb 2021 18:19:37 +0530 Subject: [PATCH] timers: fix unsafe array iteration Fixes: https://github.com/nodejs/node/issues/37222 PR-URL: https://github.com/nodejs/node/pull/37223 Reviewed-By: Antoine du Hamel Reviewed-By: Rich Trott --- lib/internal/timers.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/timers.js b/lib/internal/timers.js index a5b5c10010e95b..050d356b202d70 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -79,6 +79,7 @@ const { NumberMIN_SAFE_INTEGER, ObjectCreate, Symbol, + ReflectApply, } = primordials; const { @@ -555,7 +556,7 @@ function getTimerCallbacks(runNextTicks) { if (args === undefined) timer._onTimeout(); else - timer._onTimeout(...args); + ReflectApply(timer._onTimeout, timer, args); } finally { if (timer._repeat && timer._idleTimeout !== -1) { timer._idleTimeout = timer._repeat;