]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Workaround for clang static analyzer bug.
authorWitold Kręcicki <wpk@isc.org>
Mon, 2 Mar 2020 13:12:05 +0000 (14:12 +0100)
committerWitold Kręcicki <wpk@isc.org>
Mon, 2 Mar 2020 13:12:05 +0000 (14:12 +0100)
lib/dns/badcache.c

index 42cef0df8eae67f903863516c2f8187a2a542950..b566c21ad2efcf2d42dbd0112d033eab7e19080d 100644 (file)
@@ -150,6 +150,14 @@ badcache_resize(dns_badcache_t *bc, isc_time_t *now) {
                newsize = bc->size * 2 + 1;
        } else {
                newsize = (bc->size - 1) / 2;
+#ifdef __clang_analyzer__
+               /*
+                * XXXWPK there's a bug in clang static analyzer -
+                * `value % newsize` is considered undefined even though
+                * we check if newsize is larger than 0. This helps.
+                */
+               newsize += 1;
+#endif
        }
        RUNTIME_CHECK(newsize > 0);