Skip to content

Commit 0aa7add

Browse files
committed
fix: skip null pointer in EDS validation
Skips gap in LocalityLbEndpoints priorities that caused nullprt dereference and Envoy crashed with SEGFAULT. Affected when RING_HASH or MAGLEV loadbalancer policy is used. Signed-off-by: Pavel Kvasnička <pavel.kvasnicka@firma.seznam.cz>
1 parent 0d6e3c6 commit 0aa7add

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

source/extensions/load_balancing_policies/common/thread_aware_lb_impl.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,9 @@ TypedHashLbConfigBase::TypedHashLbConfigBase(absl::Span<const HashPolicyProto* c
393393
absl::Status TypedHashLbConfigBase::validateEndpoints(const PriorityState& priorities) const {
394394

395395
for (const auto& [hosts, locality_weights_map] : priorities) {
396+
if (hosts == nullptr) {
397+
continue;
398+
}
396399
// Sum should be at most uint32_t max value, so we can validate it by accumulating into uint64_t
397400
// and making sure there was no overflow.
398401
uint64_t host_sum = 0;

0 commit comments

Comments
 (0)