Skip to content

Commit

Permalink
Fix issue #45:out of range bug (#46)
Browse files Browse the repository at this point in the history
Author:    Shuo Zhang <[email protected]>
Date:      Mon May 20 00:25:05 2024 -0400
Committer: Shuo Zhang <[email protected]>
  • Loading branch information
WWWonderer committed May 21, 2024
1 parent fcf7432 commit 4e9888a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ fn count_occurances(text: &filebuffer::FileBuffer,
low = mid+1;
}
}
if low == size/(size_width as u64) {
return 0;
}

let start = low;

let pos = table_load_filebuffer(&table, low as usize, size_width);
Expand Down Expand Up @@ -389,6 +393,10 @@ fn count_occurances_memory(text: &[u8],
low = mid+1;
}
}
if low == size/(size_width as u64) {
return 0;
}

let start = low;

let pos = table_load(&table, low as usize, size_width);
Expand Down

0 comments on commit 4e9888a

Please sign in to comment.