Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vint.rs 97 line error #2561

Open
ddv900 opened this issue Dec 24, 2024 · 2 comments
Open

vint.rs 97 line error #2561

ddv900 opened this issue Dec 24, 2024 · 2 comments
Assignees

Comments

@ddv900
Copy link

ddv900 commented Dec 24, 2024

#[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

@PSeitz
Copy link
Contributor

PSeitz commented Dec 24, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@PSeitz @ddv900 and others