mirror of
https://github.com/azalea-rs/simdnbt.git
synced 2025-08-02 07:26:04 +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 {
|
||||
self.stack
|
||||
.get_unchecked_mut(self.depth - 1)
|
||||
.as_mut_ptr()
|
||||
.as_mut()
|
||||
.unwrap_unchecked()
|
||||
.assume_init_mut()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,6 +142,7 @@ impl TapeElement {
|
|||
}
|
||||
|
||||
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));
|
||||
Self(((kind as u64) << 56) | ((approx_len as u64) << 32) | (offset as u64))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue