From: Pieter Lexis Date: Tue, 4 Nov 2025 10:12:32 +0000 (+0100) Subject: fix(protozero): Always initialize SpanID and TraceID to zero X-Git-Tag: rec-5.4.0-alpha1~105^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b539f97c86ee6db56b7654fd1a4fab312abfefd3;p=thirdparty%2Fpdns.git fix(protozero): Always initialize SpanID and TraceID to zero Should fix CID-493276 and CID-493277. --- diff --git a/pdns/protozero-trace.hh b/pdns/protozero-trace.hh index d739c26a82..34c5c489ce 100644 --- a/pdns/protozero-trace.hh +++ b/pdns/protozero-trace.hh @@ -229,8 +229,12 @@ struct InstrumentationScope static InstrumentationScope decode(protozero::pbf_reader& reader); }; +constexpr std::array s_emptyTraceID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; struct TraceID : public std::array { + TraceID() : + array{s_emptyTraceID} {}; + [[nodiscard]] std::string toLogString() const; friend std::ostream& operator<<(std::ostream& ostrm, const TraceID& val) { @@ -254,10 +258,13 @@ struct TraceID : public std::array this->fill(0); } }; -constexpr TraceID s_emptyTraceID = {}; +constexpr std::array s_emptySpanID{0, 0, 0, 0, 0, 0, 0, 0}; struct SpanID : public std::array { + SpanID() : + array{s_emptySpanID} {}; + [[nodiscard]] std::string toLogString() const; friend std::ostream& operator<<(std::ostream& ostrm, const SpanID& val) { @@ -281,7 +288,6 @@ struct SpanID : public std::array this->fill(0); } }; -constexpr SpanID s_emptySpanID = {}; inline void fill(TraceID& trace, const std::string& data) {