Skip to content

Commit b5d0b71

Browse files
copilot nit
1 parent 6e156b7 commit b5d0b71

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • runtime/src/utils/buffer/paged

runtime/src/utils/buffer/paged/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ async fn get_page_with_checksum_from_blob(
5858
page_num: u64,
5959
logical_page_size: u64,
6060
) -> Result<(IoBuf, Checksum), Error> {
61-
let physical_page_size = logical_page_size + CHECKSUM_SIZE;
62-
let physical_page_start = page_num * physical_page_size;
61+
let physical_page_size = logical_page_size
62+
.checked_add(CHECKSUM_SIZE)
63+
.ok_or(Error::OffsetOverflow)?;
64+
let physical_page_start = page_num
65+
.checked_mul(physical_page_size)
66+
.ok_or(Error::OffsetOverflow)?;
6367

6468
let page = blob
6569
.read_at(physical_page_start, physical_page_size as usize)

0 commit comments

Comments
 (0)