From: Francis Dupont Date: Sat, 9 Dec 2017 09:15:38 +0000 (+0100) Subject: [5449] Fixes from address sanitizer run on last macOS/Xcode X-Git-Tag: trac5694_base~2^2~2^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=396d405bfd52f6ff5786950570a4ba96fe1406c6;p=thirdparty%2Fkea.git [5449] Fixes from address sanitizer run on last macOS/Xcode --- diff --git a/src/bin/dhcp6/tests/decline_unittest.cc b/src/bin/dhcp6/tests/decline_unittest.cc index 7abd22c7fd..53be0f515a 100644 --- a/src/bin/dhcp6/tests/decline_unittest.cc +++ b/src/bin/dhcp6/tests/decline_unittest.cc @@ -142,8 +142,11 @@ Dhcpv6SrvTest::acquireAndDecline(Dhcp6Client& client, // Use the second duid client.setDUID(duid2); - // Use the second IAID - client.config_.leases_[0].iaid_ = iaid2; + // Use the second IAID (but not in NO_IA which has cleared leases) + if (addr_type != NO_IA) { + ASSERT_NE(0, client.config_.leases_.size()); + client.config_.leases_[0].iaid_ = iaid2; + } // Ok, let's decline the lease. ASSERT_NO_THROW(client.doDecline(include_address_)); diff --git a/src/lib/cryptolink/openssl_common.h b/src/lib/cryptolink/openssl_common.h index 403a59d3b2..6011f7e6c8 100644 --- a/src/lib/cryptolink/openssl_common.h +++ b/src/lib/cryptolink/openssl_common.h @@ -37,6 +37,10 @@ public: SecBuf(const std::vector& x) : vec_(x) {} ~SecBuf() { +#if defined(__has_feature) && __has_feature(address_sanitizer) + // Make the address sanitizer happy assuming this won't reallocate + vec_.resize(vec_.capacity()); +#endif std::memset(&vec_[0], 0, vec_.capacity() * sizeof(T)); }; @@ -65,6 +69,10 @@ public: }; void clear() { +#if defined(__has_feature) && __has_feature(address_sanitizer) + // Make the address sanitizer happy assuming this won't reallocate + vec_.resize(vec_.capacity()); +#endif std::memset(&vec_[0], 0, vec_.capacity() * sizeof(T)); vec_.clear(); }