Skip to content

Commit 517c028

Browse files
authored
Use traps when checking initial table/memory bounds (#12929)
Instead of using a custom error string this enables fuzzing to, for example, see that a `Trap` was returned and consider the fuzz test case a normal failure. These code paths are only executed when `bulk_memory` is disabled which is pretty rare, and also explains why it's come up in fuzzing only just now after #12883.
1 parent 4c7c01d commit 517c028

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

crates/wasmtime/src/runtime/vm/instance/allocator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ fn check_table_init_bounds(
517517
// Initializer is in bounds
518518
}
519519
_ => {
520-
bail!("table out of bounds: elements segment does not fit")
520+
bail!(Trap::TableOutOfBounds);
521521
}
522522
}
523523
}
@@ -627,7 +627,7 @@ fn check_memory_init_bounds(
627627
// Initializer is in bounds
628628
}
629629
_ => {
630-
bail!("memory out of bounds: data segment does not fit")
630+
bail!(Trap::MemoryOutOfBounds);
631631
}
632632
}
633633
}

0 commit comments

Comments
 (0)