From 7985bdec71e7b4f6de8aeee3f1fde3919fe5596d Mon Sep 17 00:00:00 2001 From: Masaori Koshiba Date: Thu, 30 Apr 2026 10:20:16 +0900 Subject: [PATCH] Add length check in Doc::data_len() --- src/iocore/cache/P_CacheDoc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/iocore/cache/P_CacheDoc.h b/src/iocore/cache/P_CacheDoc.h index d501ca5308b..8dc69a8cc59 100644 --- a/src/iocore/cache/P_CacheDoc.h +++ b/src/iocore/cache/P_CacheDoc.h @@ -82,6 +82,10 @@ Doc::prefix_len() const inline uint32_t Doc::data_len() const { + if (this->len <= sizeof(self_type) + this->hlen) { + return 0; + } + return this->len - sizeof(self_type) - this->hlen; }