Merge remote-tracking branch 'origin/topic/jsiwek/coverity-1431151'

* origin/topic/jsiwek/coverity-1431151:
  Use constexpr for IPAddr::v4_mapped_prefix declaration
This commit is contained in:
Tim Wojtulewicz 2020-08-19 14:12:06 -07:00
commit 589dcf5697
4 changed files with 11 additions and 6 deletions

View file

@ -1,3 +1,9 @@
3.3.0-dev.117 | 2020-08-19 14:12:06 -0700
* Use constexpr for IPAddr::v4_mapped_prefix declaration
The inconsistent use of constexpr in the definition but not declaration
causes an unrecoverable error for Coverity as seen in issue 1431151 (Jon Siwek, Corelight)
3.3.0-dev.115 | 2020-08-19 11:49:24 -0700 3.3.0-dev.115 | 2020-08-19 11:49:24 -0700

View file

@ -1 +1 @@
3.3.0-dev.115 3.3.0-dev.117

View file

@ -12,10 +12,6 @@
#include "analyzer/Manager.h" #include "analyzer/Manager.h"
constexpr uint8_t zeek::IPAddr::v4_mapped_prefix[12] = { 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0xff, 0xff };
const zeek::IPAddr zeek::IPAddr::v4_unspecified = zeek::IPAddr(in4_addr{}); const zeek::IPAddr zeek::IPAddr::v4_unspecified = zeek::IPAddr(in4_addr{});
const zeek::IPAddr zeek::IPAddr::v6_unspecified = zeek::IPAddr(); const zeek::IPAddr zeek::IPAddr::v6_unspecified = zeek::IPAddr();

View file

@ -459,7 +459,10 @@ private:
in6_addr in6; // IPv6 or v4-to-v6-mapped address in6_addr in6; // IPv6 or v4-to-v6-mapped address
static const uint8_t v4_mapped_prefix[12]; // top 96 bits of v4-mapped-addr // Top 96 bits of a v4-mapped-addr.
static constexpr uint8_t v4_mapped_prefix[12] = { 0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0xff, 0xff };
}; };
inline IPAddr::IPAddr(Family family, const uint32_t* bytes, ByteOrder order) inline IPAddr::IPAddr(Family family, const uint32_t* bytes, ByteOrder order)