summary refs log tree commit diff
path: root/ripple/fossil/src/chunker/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ripple/fossil/src/chunker/mod.rs')
-rw-r--r--ripple/fossil/src/chunker/mod.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/ripple/fossil/src/chunker/mod.rs b/ripple/fossil/src/chunker/mod.rs
index 16e81a2..88414a2 100644
--- a/ripple/fossil/src/chunker/mod.rs
+++ b/ripple/fossil/src/chunker/mod.rs
@@ -49,7 +49,12 @@ impl<'a> Iterator for Chunker<'a> {
 		}
 
 		let bytes = self.buffer.iter().take(MAX_CHUNK_SIZE).skip(MIN_CHUNK_SIZE);
-		let mut hasher = buz::Rolling::<WINDOW_SIZE>::from_slice(&self.buffer[..MIN_CHUNK_SIZE]);
+		let mut hasher = unsafe {
+			// SAFETY: `self.buffer.len > MIN_CHUNK_SIZE`, so this is in bounds
+			buz::Rolling::<WINDOW_SIZE>::from_slice_unchecked(
+				self.buffer.get_unchecked(..MIN_CHUNK_SIZE),
+			)
+		};
 		for byte in bytes {
 			let buz::Hash(x) = hasher.sum();
 			if x % DISCRIMINATOR == DISCRIMINATOR.wrapping_sub(1) {