This is an automated email from the ASF dual-hosted git repository.

sorber 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 5a85aa39a7 Coverity Fixes (#12843)
5a85aa39a7 is described below

commit 5a85aa39a7e2a701a06ca70cf4d415c98873f863
Author: Phil Sorber <[email protected]>
AuthorDate: Fri Jan 30 13:24:48 2026 -0800

    Coverity Fixes (#12843)
    
    * Fix Coverity CID 1644785: COPY_INSTEAD_OF_MOVE in conditions.cc
    
    Use std::move() when assigning sub_qual to _query_param since
    sub_qual is not used after the assignment.
    
    * Fix Coverity suppression comments for CID 1644338, 1644327, 1644312
    
    These issues were already addressed in PR #12821 but Coverity did not
    recognize the suppression comments due to incorrect tags or placement.
    
    CID 1644338 (UNCAUGHT_EXCEPT in Stripe.cc):
    - Changed tag from fun_call_w_exception to exn_spec_violation
    - Moved comment before destructor definition (line 173) where Coverity
      reports the root_function event
    
    CID 1644327 (UNCAUGHT_EXCEPT in test_AIO.cc):
    - Changed tag from fun_call_w_exception to exn_spec_violation
    - Moved comment before main() definition (line 460) where Coverity
      reports the root_function event
    
    CID 1644312 (RESOURCE_LEAK in test_HeaderValidator.cc):
    - Changed tag from resource_leak to leaked_storage
    - Moved comment from allocation site (line 59) to leak detection
      point (line 250) where Coverity reports the leaked_storage event
---
 plugins/header_rewrite/conditions.cc              | 2 +-
 src/iocore/aio/test_AIO.cc                        | 2 +-
 src/iocore/cache/Stripe.cc                        | 2 +-
 src/proxy/hdrs/unit_tests/test_HeaderValidator.cc | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/plugins/header_rewrite/conditions.cc 
b/plugins/header_rewrite/conditions.cc
index 7f9e7c1802..4a4ddc60a4 100644
--- a/plugins/header_rewrite/conditions.cc
+++ b/plugins/header_rewrite/conditions.cc
@@ -293,7 +293,7 @@ ConditionUrl::set_qualifier(const std::string &q)
 
     if (_url_qual == URL_QUAL_QUERY) {
       if (!sub_qual.empty()) {
-        _query_param = sub_qual;
+        _query_param = std::move(sub_qual);
         Dbg(pi_dbg_ctl, "\tQuery parameter sub-key: %s", _query_param.c_str());
       }
     } else {
diff --git a/src/iocore/aio/test_AIO.cc b/src/iocore/aio/test_AIO.cc
index 2900c87f03..0cff8b35c4 100644
--- a/src/iocore/aio/test_AIO.cc
+++ b/src/iocore/aio/test_AIO.cc
@@ -456,10 +456,10 @@ public:
 
 #endif
 
+// coverity[exn_spec_violation] - called functions may throw but this is a 
test program
 int
 main(int argc, char *argv[])
 {
-  // coverity[fun_call_w_exception] - called functions may throw but this is a 
test program
   int i;
 
   // Read the configuration file
diff --git a/src/iocore/cache/Stripe.cc b/src/iocore/cache/Stripe.cc
index 0fed76adfb..373d545ae1 100644
--- a/src/iocore/cache/Stripe.cc
+++ b/src/iocore/cache/Stripe.cc
@@ -170,10 +170,10 @@ Stripe::_init_directory(std::size_t directory_size, int 
header_size, int footer_
   this->directory.footer = reinterpret_cast<StripeHeaderFooter 
*>(this->directory.raw_dir + footer_offset);
 }
 
+// coverity[exn_spec_violation] - ink_assert aborts (doesn't throw), Dbg is 
exception-safe
 Stripe::~Stripe()
 {
   if (this->directory.raw_dir != nullptr) {
-    // coverity[fun_call_w_exception] - ink_assert aborts (doesn't throw), Dbg 
is exception-safe
     // Debug logging to track cleanup - helps correlate with crash location
     Dbg(dbg_ctl_cache_free, "Stripe %s: freeing raw_dir=%p size=%zu huge=%s", 
hash_text.get() ? hash_text.get() : "(null)",
         this->directory.raw_dir, this->directory.raw_dir_size, 
this->directory.raw_dir_huge ? "true" : "false");
diff --git a/src/proxy/hdrs/unit_tests/test_HeaderValidator.cc 
b/src/proxy/hdrs/unit_tests/test_HeaderValidator.cc
index c11bc9d8d7..75c90404ce 100644
--- a/src/proxy/hdrs/unit_tests/test_HeaderValidator.cc
+++ b/src/proxy/hdrs/unit_tests/test_HeaderValidator.cc
@@ -56,8 +56,6 @@ TEST_CASE("testIsHeaderValid", "[proxy][hdrtest]")
 {
   HTTPHdr hdr;
   // extra to prevent proxy allocation.
-  // coverity[resource_leak] - heap is freed via hdr.destroy() which calls
-  // HdrHeapSDKHandle::destroy() -> m_heap->destroy()
   HdrHeap *heap = new_HdrHeap(HdrHeap::DEFAULT_SIZE + 64);
 
   SECTION("Test (valid) request with 4 required pseudo headers")
@@ -249,4 +247,6 @@ TEST_CASE("testIsHeaderValid", "[proxy][hdrtest]")
   }
   // teardown
   hdr.destroy();
+  // coverity[leaked_storage] - heap is freed via hdr.destroy() which calls
+  // HdrHeapSDKHandle::destroy() -> m_heap->destroy()
 }

Reply via email to