Fix BGI Bp parse bug

This commit is contained in:
2025-08-12 13:45:57 +08:00
parent 2ca4f6475f
commit c54c7fe4e6
4 changed files with 9 additions and 5 deletions

View File

@@ -73,10 +73,14 @@ impl BGIBpScript {
}
let mut last_instr_pos = 0;
reader.seek(SeekFrom::Start(header_size as u64))?;
for _ in 0..instr_size / 4 {
let instr = reader.read_u32()?;
let max_instr_len = reader.data.len() - 4;
while reader.pos < max_instr_len {
let instr = reader.cpeek_u32()?;
if instr == 0x17 {
last_instr_pos = reader.pos;
reader.pos += 4;
} else {
reader.pos += 1;
}
}
if last_instr_pos == 0 {