From 63f02036012e9e80934fd50faa7b690d9cf7d795 Mon Sep 17 00:00:00 2001 From: Szymon Walter Date: Tue, 20 Mar 2018 10:33:17 +0100 Subject: [PATCH] add assert to block address unsafe constructos --- src/block.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/block.rs b/src/block.rs index 5423631..b9b353e 100644 --- a/src/block.rs +++ b/src/block.rs @@ -43,6 +43,7 @@ pub struct Address { impl Address { pub unsafe fn new_unchecked(block: usize, offset: usize) -> Address { + assert!(offset < S::SIZE, "offset out of block bounds"); let _phantom = PhantomData; Address { block,