Skip to content

Commit 1b636e9

Browse files
Skip bounds check for inline slices (#277)
1 parent a7793f0 commit 1b636e9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/atom.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ impl<Static: StaticAtomSet> ops::Deref for Atom<Static> {
254254
}
255255
INLINE_TAG => {
256256
let len = (self.unsafe_data() & LEN_MASK) >> LEN_OFFSET;
257+
debug_assert!(len as usize <= MAX_INLINE_LEN);
257258
let src = inline_atom_slice(&self.unsafe_data);
258-
str::from_utf8_unchecked(&src[..(len as usize)])
259+
str::from_utf8_unchecked(src.get_unchecked(..(len as usize)))
259260
}
260261
STATIC_TAG => Static::get().atoms[self.static_index() as usize],
261262
_ => debug_unreachable!(),

0 commit comments

Comments
 (0)