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);