Skip to content

Commit

Permalink
Debug info: sort by generated-code offset to avoid gimli panic.
Browse files Browse the repository at this point in the history
This issue was found while fuzzing the new backend (bytecodealliance#2453); I suspect
that it arises with the new backend because we can sink instructions
(e.g. loads or extends) in more interesting ways than before, but I'm
not entirely sure.

Test coverage will be via the fuzz corpus once bytecodealliance#2453 lands.
  • Loading branch information
cfallin committed Dec 2, 2020
1 parent 51c1d4b commit 679d855
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions crates/debug/src/transform/address_transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ fn build_function_addr_map(
wasm: offset,
});
}
fn_map.sort_by_key(|entry| entry.generated);

if cfg!(debug) {
// fn_map is sorted by the generated field -- see FunctionAddressMap::instructions.
Expand Down

0 comments on commit 679d855

Please sign in to comment.