Skip to content

Commit

Permalink
Merge pull request #175 from Tpt/find-entry-opt
Browse files Browse the repository at this point in the history
IndexTable::find_entry: add assertion bound checking
  • Loading branch information
arkpar authored Feb 1, 2023
2 parents a829c36 + 40fcdb8 commit 6ab6f45
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ impl IndexTable {

#[inline(never)]
fn find_entry(&self, key_prefix: u64, sub_index: usize, chunk: &[u8]) -> (Entry, usize) {
assert!(chunk.len() >= CHUNK_ENTRIES * 8);
let partial_key = Entry::extract_key(key_prefix, self.id.index_bits());
for i in sub_index..CHUNK_ENTRIES {
let entry = Self::read_entry(chunk, i);
Expand Down

0 comments on commit 6ab6f45

Please sign in to comment.