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 <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Darshan Sen authored and Danielle Adams committed 2021-02-16 09:12:45 -05:00
1 parent 3fee5b2219
commit dc38dd2c6f
1 file changed
+2 -1
+2 -1
View File
@@ -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;