Skip to content

Commit

Permalink
Fixed a potential bug that could cause a Segment Fault when insert a …
Browse files Browse the repository at this point in the history
…large tuple
  • Loading branch information
CodeZHXS committed Jun 25, 2024
1 parent 70bcc50 commit ecb0643
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/storage/page/table_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ecb0643

Please sign in to comment.