Skip to content

Commit a599815

Browse files
addaleaxtargos
authored andcommitted
src: fix off-by-one error in native SetImmediate
Previously, the throwing callback would have been re-executed in case of an exception. This patch corrects the calculation to exclude the callback. PR-URL: #28082 Fixes: #26754 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 694faf1 commit a599815

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/env.cc

+5
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,11 @@ void Environment::RunAndClearNativeImmediates() {
641641
if (!try_catch.HasTerminated())
642642
FatalException(isolate(), try_catch);
643643

644+
// We are done with the current callback. Increase the counter so that
645+
// the steps below make everything *after* the current item part of
646+
// the new list.
647+
it++;
648+
644649
// Bail out, remove the already executed callbacks from list
645650
// and set up a new TryCatch for the other pending callbacks.
646651
std::move_backward(it, list.end(), list.begin() + (list.end() - it));

0 commit comments

Comments
 (0)