mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-20 23:37:56 +03:00
wasm: treat wrong section ID as empty section
This commit is contained in:
parent
dad1d14ef8
commit
4a22d22515
@ -136,15 +136,10 @@ fn parse_section(
|
||||
message: "End of file".into(),
|
||||
});
|
||||
}
|
||||
|
||||
// If we see the wrong section ID, assume the one we were looking for is just empty
|
||||
if module_bytes[*cursor] != expected_id as u8 {
|
||||
let actual_id: SectionId = unsafe { std::mem::transmute(module_bytes[*cursor]) };
|
||||
return Err(ParseError {
|
||||
offset: *cursor,
|
||||
message: format!(
|
||||
"Expected section '{:?}', but found '{:?}'",
|
||||
expected_id, actual_id
|
||||
),
|
||||
});
|
||||
return Ok((0, *cursor..*cursor));
|
||||
}
|
||||
*cursor += 1;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user