diff --git a/table/format.cc b/table/format.cc index 7647372..ae998c1 100644 --- a/table/format.cc +++ b/table/format.cc @@ -41,6 +41,10 @@ void Footer::EncodeTo(std::string* dst) const { } Status Footer::DecodeFrom(Slice* input) { + if (input->size() < kEncodedLength) { + return Status::Corruption("not an sstable (footer too short)"); + } + const char* magic_ptr = input->data() + kEncodedLength - 8; const uint32_t magic_lo = DecodeFixed32(magic_ptr); const uint32_t magic_hi = DecodeFixed32(magic_ptr + 4);