From 6fb83ad910efd3f9f254dafd9988bd441dbbf161 Mon Sep 17 00:00:00 2001 From: bneradt Date: Tue, 5 May 2026 12:09:39 -0500 Subject: [PATCH] Remove cache alternate vector detach Cache alternate detach is a private helper with no current callers, and its compaction loop contains a latent out-of-bounds read if the helper is ever used. Keeping the dead path around preserves a future cache metadata hazard without providing any current behavior. This removes the unused helper and its declaration instead of repairing the unreachable implementation. Existing alternate removal continues to use the live remove path. --- src/iocore/cache/CacheHttp.cc | 21 --------------------- src/iocore/cache/P_CacheHttp.h | 1 - 2 files changed, 22 deletions(-) diff --git a/src/iocore/cache/CacheHttp.cc b/src/iocore/cache/CacheHttp.cc index b1d7b57f348..4c48db5adb0 100644 --- a/src/iocore/cache/CacheHttp.cc +++ b/src/iocore/cache/CacheHttp.cc @@ -63,27 +63,6 @@ CacheHTTPInfoVector::insert(CacheHTTPInfo *info, int index) return index; } -/*------------------------------------------------------------------------- - -------------------------------------------------------------------------*/ - -void -CacheHTTPInfoVector::detach(int idx, CacheHTTPInfo *r) -{ - int i; - - ink_assert(idx >= 0); - ink_assert(idx < xcount); - - r->copy_shallow(&data[idx].alternate); - data[idx].alternate.destroy(); - - for (i = idx; i < (xcount - 1); i++) { - data[i] = data[i + i]; - } - - xcount -= 1; -} - /*------------------------------------------------------------------------- -------------------------------------------------------------------------*/ diff --git a/src/iocore/cache/P_CacheHttp.h b/src/iocore/cache/P_CacheHttp.h index 6a30b15b5ed..77f84713202 100644 --- a/src/iocore/cache/P_CacheHttp.h +++ b/src/iocore/cache/P_CacheHttp.h @@ -50,7 +50,6 @@ struct CacheHTTPInfoVector { } int insert(CacheHTTPInfo *info, int id = -1); CacheHTTPInfo *get(int idx); - void detach(int idx, CacheHTTPInfo *r); void remove(int idx, bool destroy); void clear(bool destroy = true); void