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 Michaël Zasso committed 2021-06-11 09:29:59 +02:00
1 parent d9eb8b3ed0
commit 1dc7fd238c
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;