shukitchan opened a new pull request, #13140:
URL: https://github.com/apache/trafficserver/pull/13140

   This pull request refactors the FNV-1a hash implementation to simplify 
initialization and improve code clarity. The main changes involve moving the 
FNV initial constants into the class definitions as `constexpr` static members, 
initializing member variables directly, and simplifying constructors.
   
   Hash algorithm improvements:
   
   * Moved FNV initial constants (`FNV_INIT_32`, `FNV_INIT_64`) into the 
respective classes (`ATSHash32FNV1a`, `ATSHash64FNV1a`) as `static constexpr` 
members and used them to initialize `hval` directly in the class definition 
(`include/tscore/HashFNV.h`). 
[[1]](diffhunk://#diff-33a77336d448662b07ef7b2bceefa94299417b94802f37d95b4183594f56c47dL48-R49)
 
[[2]](diffhunk://#diff-33a77336d448662b07ef7b2bceefa94299417b94802f37d95b4183594f56c47dL79-R81)
   * Updated the `clear()` methods to use the new `fnv_init` static member 
instead of external constants (`src/tscore/HashFNV.cc`). 
[[1]](diffhunk://#diff-9151b9f73b3fe93f5c6f8f3aaf86436b7c226c8e538db8560cb77c06899e5dbbL35-R33)
 
[[2]](diffhunk://#diff-9151b9f73b3fe93f5c6f8f3aaf86436b7c226c8e538db8560cb77c06899e5dbbL57-R48)
   * Simplified constructors for `ATSHash32FNV1a` and `ATSHash64FNV1a` by using 
default constructors instead of explicitly calling `clear()` 
(`src/tscore/HashFNV.cc`).
   
   Code style and safety:
   
   * Zero-initialized the `type_buf` buffer in `Http3FrameFactory::create` for 
improved safety (`src/proxy/http3/Http3Frame.cc`).
   
   This fixes the reported fuzzing issues
   https://oss-fuzz.com/testcase-detail/4669620266270720
   https://oss-fuzz.com/testcase-detail/4793610426449920


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to