mirror of
https://github.com/azalea-rs/simdnbt.git
synced 2025-08-02 23:44:40 +00:00
fix panic on large lists
This commit is contained in:
parent
dd45102d75
commit
c9e8ebe341
2 changed files with 2 additions and 3 deletions
|
@ -340,9 +340,7 @@ impl ParsingStack {
|
||||||
unsafe {
|
unsafe {
|
||||||
self.stack
|
self.stack
|
||||||
.get_unchecked_mut(self.depth - 1)
|
.get_unchecked_mut(self.depth - 1)
|
||||||
.as_mut_ptr()
|
.assume_init_mut()
|
||||||
.as_mut()
|
|
||||||
.unwrap_unchecked()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,6 +142,7 @@ impl TapeElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_with_approx_len_and_offset(kind: TapeTagKind, approx_len: u32, offset: u32) -> Self {
|
pub fn new_with_approx_len_and_offset(kind: TapeTagKind, approx_len: u32, offset: u32) -> Self {
|
||||||
|
let approx_len = approx_len.min(0xff_ffff);
|
||||||
debug_assert!(approx_len < 2u32.pow(24));
|
debug_assert!(approx_len < 2u32.pow(24));
|
||||||
Self(((kind as u64) << 56) | ((approx_len as u64) << 32) | (offset as u64))
|
Self(((kind as u64) << 56) | ((approx_len as u64) << 32) | (offset as u64))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue