repl_test: update build.rs to work with Zig 0.9 (like test_gen)

This commit is contained in:
Brian Carroll 2022-04-11 14:19:56 +01:00
parent 249925cb23
commit a663d335fc
3 changed files with 91 additions and 27 deletions

View file

@ -115,7 +115,7 @@ fn section_size(bytes: &[u8]) -> usize {
}
fn parse_section<'a>(id: SectionId, module_bytes: &'a [u8], cursor: &mut usize) -> (u32, &'a [u8]) {
if module_bytes[*cursor] != id as u8 {
if (*cursor >= module_bytes.len()) || (module_bytes[*cursor] != id as u8) {
return (0, &[]);
}
*cursor += 1;