Uh oh!
There was an error while loading. Please reload this page.
timers: fix arbitrary object clearImmediate errors - #37824
Conversation
ea16354 to
f0f059fComparenodejs-github-bot
commented
Mar 20, 2021
addaleax
commented
Mar 20, 2021
Can you add regression tests for these? |
Done. I'm not 100% happy with the non-REPL test, as looking at the code even sending regular objects to clearImmediate looks like it has some side-effects which might corrupt some state, but it doesn't throw now. |
nodejs-github-bot
commented
Mar 20, 2021
There was a problem hiding this comment.
This test is not really required, since it was just caused by the crash but it does not hurt either.
There was a problem hiding this comment.
The issue, I think, was a bit different (if by "the crash" you mean that NRE for this._idleNext). The REPL crash was caused because an undefinedasync_id was given to emitDestroy, and this caused an error in emitDestroyScript (as the check there only checks <= 0 and undefined is not <= 0).
There was a problem hiding this comment.
Maybe a better fix would've been to actually change the code there (in async_hooks.js) to check for hasHooks(kDestroy) && asyncId > 0 instead of an early return - but that's probably out of scope for this minor issue, and maybe a crash there is better than "swallowing" bad async_ids which might cover errors elsewhere.
Uh oh!
There was an error while loading. Please reload this page.
nodejs-github-bot
commented
Mar 22, 2021
nodejs-github-bot
commented
Mar 22, 2021
nodejs-github-bot
commented
Mar 23, 2021
Fix errors that are caused by invoking clearImmediate with arbitrary objects. fixes: nodejs#37806 PR-URL: nodejs#37824Fixes: nodejs#37806 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
f444985 to
fcc934fCompareaduh95
commented
Mar 28, 2021
Landed in fcc934f |
Fix errors that are caused by invoking clearImmediate with arbitrary objects. fixes: #37806 PR-URL: #37824Fixes: #37806 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fix errors that are caused by invoking clearImmediate with arbitrary objects. fixes: #37806 PR-URL: #37824Fixes: #37806 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fix errors that are caused by invoking clearImmediate with arbitrary objects. fixes: #37806 PR-URL: #37824Fixes: #37806 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Fix errors that are caused by invoking clearImmediate with arbitrary objects. (e.g.
clearImmediate({}))timers.jsfixes the REPL crash.internal/timers.jsfixes another error that gets thrown.Both of the above already exist in the
clearTimeoutpath.Fixes: #37806