Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TieredStorage] Boundary check for accessing hot account meta #34349

Merged
merged 7 commits into from
Dec 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improving assert! message.
yhchiang-sol committed Dec 18, 2023
commit 10431cc951a1e5594cb01d0735c1d47b141eb375
6 changes: 3 additions & 3 deletions accounts-db/src/tiered_storage/hot.rs
Original file line number Diff line number Diff line change
@@ -286,8 +286,8 @@ impl HotStorageReader {
assert!(
offset.saturating_add(std::mem::size_of::<HotAccountMeta>())
<= self.footer.index_block_offset as usize,
"HotAccountOffset ({}) exceeds accounts blocks offset boundary ({}).",
offset.saturating_add(std::mem::size_of::<HotAccountMeta>()),
"reading HotAccountOffset ({}) would exceed accounts blocks offset boundary ({}).",
offset,
self.footer.index_block_offset,
);
let (meta, _) = get_pod::<HotAccountMeta>(&self.mmap, offset)?;
@@ -579,7 +579,7 @@ pub mod tests {
}

#[test]
#[should_panic(expected = "exceeds accounts blocks offset boundary")]
#[should_panic(expected = "would exceed accounts blocks offset boundary")]
fn test_get_acount_meta_from_offset_out_of_bounds() {
yhchiang-sol marked this conversation as resolved.
Show resolved Hide resolved
// Generate a new temp path that is guaranteed to NOT already have a file.
let temp_dir = TempDir::new().unwrap();