1
0
Fork 0
mirror of https://github.com/azalea-rs/simdnbt.git synced 2025-08-02 07:26:04 +00:00

fix an out of bounds write

This commit is contained in:
mat 2024-06-17 03:15:30 +00:00
parent 9d4f1ec4c2
commit 31be4d3231

View file

@ -316,11 +316,10 @@ impl ParsingStack {
#[inline]
pub fn push(&mut self, state: ParsingStackElement) -> Result<(), Error> {
// self.stack[self.depth] = MaybeUninit::new(state);
unsafe { self.stack.get_unchecked_mut(self.depth).write(state) };
self.depth += 1;
if self.depth > MAX_DEPTH {
if self.depth >= MAX_DEPTH {
Err(Error::MaxDepthExceeded)
} else {
Ok(())