diff options
author | Anatoli Papirovski <apapirovski@mac.com> | 2018-02-05 09:50:18 -0500 |
---|---|---|
committer | Anatoli Papirovski <apapirovski@mac.com> | 2018-02-08 09:01:54 -0500 |
commit | 568b6a5c9e9893fbb6ab811cfa76841fb3c80a0a (patch) | |
tree | 166114d93b0c6bd7134f9c2b02be7056dff5c408 /lib/timers.js | |
parent | 1b05d7bc86d30d47d021cc37476fb0131490a74b (diff) | |
download | android-node-v8-568b6a5c9e9893fbb6ab811cfa76841fb3c80a0a.tar.gz android-node-v8-568b6a5c9e9893fbb6ab811cfa76841fb3c80a0a.tar.bz2 android-node-v8-568b6a5c9e9893fbb6ab811cfa76841fb3c80a0a.zip |
timers: be more defensive with intervals
It's possible for user-code to flip an existing timeout to
be an interval during its execution, in which case the
current code would crash due to start being undefined. Fix
this by providing a default start value within rearm.
PR-URL: https://github.com/nodejs/node/pull/18579
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/timers.js')
-rw-r--r-- | lib/timers.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/timers.js b/lib/timers.js index 7b7fb4e04f..4d41b5dc8a 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -442,8 +442,7 @@ function ontimeout(timer, start) { rearm(timer, start); } - -function rearm(timer, start) { +function rearm(timer, start = TimerWrap.now()) { // // Do not re-arm unenroll'd or closed timers. if (timer._idleTimeout === -1) return; |