Fix off-by-one errors

This commit is contained in:
Simon Gellis 2025-09-06 09:57:37 -04:00
parent 1c146590fe
commit 30ee8c06f7
1 changed files with 2 additions and 2 deletions

View File

@ -154,14 +154,14 @@ fn extract_isx_symbols(input: &[u8]) -> Option<Vec<Symbol>> {
// Range (Virtual Boy)
let count_bytes;
(count_bytes, buf) = buf.split_first_chunk()?;
let count = u16::from_le_bytes(*count_bytes) + 1;
let count = u16::from_le_bytes(*count_bytes);
(_, buf) = buf.split_at_checked(count as usize * 9)?;
}
0x14 => {
// Symbol (Virtual Boy)
let count_bytes;
(count_bytes, buf) = buf.split_first_chunk()?;
let count = u16::from_le_bytes(*count_bytes) + 1;
let count = u16::from_le_bytes(*count_bytes);
for _ in 0..count {
let name_len;
(name_len, buf) = buf.split_first()?;