tantivy icon indicating copy to clipboard operation
tantivy copied to clipboard

vint.rs 97 line error

Open ddv900 opened this issue 11 months ago • 2 comments

#[inline] pub(crate) fn uncompress_unsorted_until_end( compressed_data: &[u8], output_arr: &mut [u32], ) -> usize { let mut num_read_bytes = 0; for (num_ints_written, output_mut) in output_arr.iter_mut().enumerate() { if compressed_data.len() == num_read_bytes { return num_ints_written; } let mut result = 0u32; let mut shift = 0u32; loop { let cur_byte = compressed_data[num_read_bytes]; num_read_bytes += 1; result += u32::from(cur_byte % 128u8) << shift; if cur_byte & 128u8 != 0u8 { break; } shift += 7; } *output_mut = result; } output_arr.len() }

进入loop循环后,当循环次数增加时,num_read_bytes自增超出compressed_data长度,产生报错 (After entering a loop, when the number of cycles increases, the num_read_bytes automatically exceeds the length of compressed_data, and an error message is generated) tantivy-0.22.0\src\postings\compression\vint.rs:97:28: index out of bounds: the len is 26 but the index is 26

ddv900 avatar Dec 24 '24 04:12 ddv900

When does this issue occur? Do you have something to reproduce?

PSeitz avatar Dec 24 '24 10:12 PSeitz