From 1cf5265ef4269f438f11f39bd042af8f55f7c10f Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Sun, 1 Mar 2026 11:53:04 +0800 Subject: [PATCH] Fix resize should contain original_size --- table/format.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/table/format.cc b/table/format.cc index ae998c1f30..faf71f6ee4 100644 --- a/table/format.cc +++ b/table/format.cc @@ -33,7 +33,7 @@ void Footer::EncodeTo(std::string* dst) const { const size_t original_size = dst->size(); metaindex_handle_.EncodeTo(dst); index_handle_.EncodeTo(dst); - dst->resize(2 * BlockHandle::kMaxEncodedLength); // Padding + dst->resize(original_size + 2 * BlockHandle::kMaxEncodedLength); // Padding PutFixed32(dst, static_cast(kTableMagicNumber & 0xffffffffu)); PutFixed32(dst, static_cast(kTableMagicNumber >> 32)); assert(dst->size() == original_size + kEncodedLength);