From ecb064354d5ff90a703445e30d893c1864422063 Mon Sep 17 00:00:00 2001 From: chenyujie Date: Tue, 25 Jun 2024 22:31:38 +0800 Subject: [PATCH] Fixed a potential bug that could cause a Segment Fault when insert a large tuple --- src/storage/page/table_page.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/page/table_page.cpp b/src/storage/page/table_page.cpp index e1d0c917a..9a1779c0b 100644 --- a/src/storage/page/table_page.cpp +++ b/src/storage/page/table_page.cpp @@ -38,7 +38,7 @@ auto TablePage::GetNextTupleOffset(const TupleMeta &meta, const Tuple &tuple) co } auto tuple_offset = slot_end_offset - tuple.GetLength(); auto offset_size = TABLE_PAGE_HEADER_SIZE + TUPLE_INFO_SIZE * (num_tuples_ + 1); - if (tuple_offset < offset_size) { + if (tuple_offset < offset_size || tuple_offset >= BUSTUB_PAGE_SIZE) { return std::nullopt; } return tuple_offset;