From 04bfa07df31ecd1b4fab73866ea902053599dfe4 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 beec22ecf43af7..d1eca3d996722d 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;