From: Witold Kręcicki Date: Mon, 2 Mar 2020 13:12:05 +0000 (+0100) Subject: Workaround for clang static analyzer bug. X-Git-Tag: v9.17.1~88^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c8f30974576f1f3ec15ebdf74051d0c9b201396;p=thirdparty%2Fbind9.git Workaround for clang static analyzer bug. --- diff --git a/lib/dns/badcache.c b/lib/dns/badcache.c index 42cef0df8ea..b566c21ad2e 100644 --- a/lib/dns/badcache.c +++ b/lib/dns/badcache.c @@ -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);