From 264f003b0e8b761c606951239cbeb9fc5413f453 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 7 Aug 2020 16:24:05 +0200 Subject: [PATCH] src: fix `size` underflow in CallbackQueue Only decrease the size when actually removing items. PR-URL: https://github.com/nodejs/node/pull/34662 Fixes: https://github.com/nodejs/node/issues/34657 Refs: https://github.com/nodejs/node/pull/34572 Reviewed-By: Gabriel Schulhof Reviewed-By: James M Snell --- src/callback_queue-inl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/callback_queue-inl.h b/src/callback_queue-inl.h index e83c81cd0dd802..8c6919912e161b 100644 --- a/src/callback_queue-inl.h +++ b/src/callback_queue-inl.h @@ -22,8 +22,8 @@ CallbackQueue::Shift() { head_ = ret->get_next(); if (!head_) tail_ = nullptr; // The queue is now empty. + size_--; } - size_--; return ret; }