From afb345b0e8a73c20264479282ac62ebaf6deb08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 13 Aug 2024 12:48:23 +0200 Subject: [PATCH] Don't skip the counting if fcount_incr() is called with force==true (v2) The fcount_incr() was not increasing counter->count when force was set to true, but fcount_decr() would try to decrease the counter leading to underflow and assertion failure. Swap the order of the arguments in the condition, so the !force is evaluated after incrementing the .count. (cherry picked from commit 8e86e55af19f70d056b3a8f651d75500534463f6) --- lib/dns/resolver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 78e0634aab..dd944f8670 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -1487,7 +1487,7 @@ fcount_incr(fetchctx_t *fctx, bool force) { INSIST(spill > 0); LOCK(&counter->lock); - if (!force && ++counter->count > spill) { + if (++counter->count > spill && !force) { counter->count--; INSIST(counter->count > 0); counter->dropped++;