From 889cc681eb1d657d8952158c19120cd6fffc70df Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 24 Nov 2017 08:47:52 +1100 Subject: [PATCH] in rdbdb.c:setsigningtime stop breaking heap invariant property unless we are going to restore the invariant property (cherry picked from commit 6ead410268963ff07641170a17dcc98600c3aaaa) --- lib/dns/rbtdb.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 7e3195d57d..b89bc487b4 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -7694,8 +7694,16 @@ setsigningtime(dns_db_t *db, dns_rdataset_t *rdataset, isc_stdtime_t resign) { isc_rwlocktype_write); oldheader = *header; - header->resign = (isc_stdtime_t)(dns_time64_from32(resign) >> 1); - header->resign_lsb = resign & 0x1; + /* + * Only break the heap invariant (by adjusting resign and resign_lsb) + * if we are going to be restoring it by calling isc_heap_increased + * or isc_heap_decreased. + */ + if (resign != 0) { + header->resign = + (isc_stdtime_t)(dns_time64_from32(resign) >> 1); + header->resign_lsb = resign & 0x1; + } if (header->heap_index != 0) { INSIST(RESIGN(header)); if (resign == 0) {