From 72574dac02bfecded82a544655e8bfd83154caec Mon Sep 17 00:00:00 2001 From: HaoranYi Date: Mon, 9 Oct 2023 09:38:00 -0500 Subject: [PATCH] Assert acount hash mmap file capacity > 0 (#33575) assert mmap capacity > 0 Co-authored-by: HaoranYi --- accounts-db/src/accounts_hash.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/accounts-db/src/accounts_hash.rs b/accounts-db/src/accounts_hash.rs index 66a77c8188..222f2b1a64 100644 --- a/accounts-db/src/accounts_hash.rs +++ b/accounts-db/src/accounts_hash.rs @@ -97,6 +97,7 @@ impl AccountHashesFile { // Theoretical performance optimization: write a zero to the end of // the file so that we won't have to resize it later, which may be // expensive. + assert!(self.capacity > 0); data.seek(SeekFrom::Start((self.capacity - 1) as u64)) .unwrap(); data.write_all(&[0]).unwrap();