This is an automated email from the ASF dual-hosted git repository.
shukitchan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 4d4086ab48 Fix use-of-uninitialized-value problem from fuzzing (#13140)
4d4086ab48 is described below
commit 4d4086ab481d3d0f37ca1bf09d87e9b6063d6a45
Author: Kit Chan <[email protected]>
AuthorDate: Sun May 17 10:24:11 2026 -0700
Fix use-of-uninitialized-value problem from fuzzing (#13140)
---
include/tscore/HashFNV.h | 6 ++++--
src/proxy/http3/Http3Frame.cc | 2 +-
src/tscore/HashFNV.cc | 19 +++++--------------
3 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/include/tscore/HashFNV.h b/include/tscore/HashFNV.h
index 0ea09bbe08..57a7c4b0bb 100644
--- a/include/tscore/HashFNV.h
+++ b/include/tscore/HashFNV.h
@@ -45,7 +45,8 @@ struct ATSHash32FNV1a : ATSHash32 {
void clear() override;
private:
- uint32_t hval;
+ static constexpr uint32_t fnv_init = 0x811c9dc5u;
+ uint32_t hval{fnv_init};
};
template <typename Transform>
@@ -76,7 +77,8 @@ struct ATSHash64FNV1a : ATSHash64 {
void clear() override;
private:
- uint64_t hval;
+ static constexpr uint64_t fnv_init = 0xcbf29ce484222325ull;
+ uint64_t hval{fnv_init};
};
template <typename Transform>
diff --git a/src/proxy/http3/Http3Frame.cc b/src/proxy/http3/Http3Frame.cc
index b3de9d2bff..0060dad16d 100644
--- a/src/proxy/http3/Http3Frame.cc
+++ b/src/proxy/http3/Http3Frame.cc
@@ -505,7 +505,7 @@ Http3FrameFactory::create(IOBufferReader &reader)
ts::Http3Config::scoped_config params;
Http3Frame *frame = nullptr;
- uint8_t type_buf[FRAME_TYPE_MAX_BYTES];
+ uint8_t type_buf[FRAME_TYPE_MAX_BYTES]{};
reader.memcpy(type_buf, sizeof(type_buf));
Http3FrameType type = Http3Frame::type(type_buf, sizeof(type_buf));
diff --git a/src/tscore/HashFNV.cc b/src/tscore/HashFNV.cc
index b060ab4205..b84d9a8f78 100644
--- a/src/tscore/HashFNV.cc
+++ b/src/tscore/HashFNV.cc
@@ -9,14 +9,8 @@
#include "tscore/HashFNV.h"
-static const uint32_t FNV_INIT_32 = 0x811c9dc5u;
-static const uint64_t FNV_INIT_64 = 0xcbf29ce484222325ull;
-
-// FNV-1a 64bit
-ATSHash32FNV1a::ATSHash32FNV1a()
-{
- this->clear();
-}
+// FNV-1a 32bit
+ATSHash32FNV1a::ATSHash32FNV1a() = default;
void
ATSHash32FNV1a::final()
@@ -32,14 +26,11 @@ ATSHash32FNV1a::get() const
void
ATSHash32FNV1a::clear()
{
- hval = FNV_INIT_32;
+ hval = fnv_init;
}
// FNV-1a 64bit
-ATSHash64FNV1a::ATSHash64FNV1a()
-{
- this->clear();
-}
+ATSHash64FNV1a::ATSHash64FNV1a() = default;
void
ATSHash64FNV1a::final()
{
@@ -54,5 +45,5 @@ ATSHash64FNV1a::get() const
void
ATSHash64FNV1a::clear()
{
- hval = FNV_INIT_64;
+ hval = fnv_init;
}