summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--table/format.cc4
1 files changed, 4 insertions, 0 deletions
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);