Skip to content

Commit 666d337

Browse files
authored
Update the Wasmi differential fuzzing oracle to v1.0 (#12312)
* update the wasmi fuzzing oracle to v1.0.7 * make wasmi oracle impl compile again * apply rustfmt
1 parent 73ef034 commit 666d337

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/fuzzing/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ wasm-smith = { workspace = true, features = ['serde'] }
3434
wasm-mutate = { workspace = true }
3535
wasm-compose = { workspace = true }
3636
wasm-spec-interpreter = { path = "./wasm-spec-interpreter", optional = true }
37-
wasmi = { version = "0.51.1", default-features = false, features = ["std", "simd"] }
37+
wasmi = { version = "1.0.7", default-features = false, features = ["std", "simd"] }
3838
futures = { workspace = true, features = ['async-await'] }
3939
wasmtime-test-util = { workspace = true, features = ['wast', 'component-fuzz', 'component'] }
4040
serde_json = { workspace = true }

crates/fuzzing/src/oracles/diff_wasmi.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl WasmiEngine {
4040
}
4141
}
4242

43-
fn trap_code(&self, err: &Error) -> Option<wasmi::core::TrapCode> {
43+
fn trap_code(&self, err: &Error) -> Option<wasmi::TrapCode> {
4444
let err = err.downcast_ref::<wasmi::Error>()?;
4545
if let Some(code) = err.as_trap_code() {
4646
return Some(code);
@@ -49,12 +49,12 @@ impl WasmiEngine {
4949
match err.kind() {
5050
wasmi::errors::ErrorKind::Instantiation(
5151
wasmi::errors::InstantiationError::ElementSegmentDoesNotFit { .. },
52-
) => Some(wasmi::core::TrapCode::TableOutOfBounds),
52+
) => Some(wasmi::TrapCode::TableOutOfBounds),
5353
wasmi::errors::ErrorKind::Memory(wasmi::errors::MemoryError::OutOfBoundsAccess) => {
54-
Some(wasmi::core::TrapCode::MemoryOutOfBounds)
54+
Some(wasmi::TrapCode::MemoryOutOfBounds)
5555
}
5656
wasmi::errors::ErrorKind::Table(wasmi::errors::TableError::CopyOutOfBounds) => {
57-
Some(wasmi::core::TrapCode::TableOutOfBounds)
57+
Some(wasmi::TrapCode::TableOutOfBounds)
5858
}
5959
_ => {
6060
log::trace!("unknown wasmi error: {:?}", err.kind());
@@ -87,16 +87,13 @@ impl DiffEngine for WasmiEngine {
8787
}
8888

8989
fn is_non_deterministic_error(&self, err: &Error) -> bool {
90-
matches!(
91-
self.trap_code(err),
92-
Some(wasmi::core::TrapCode::StackOverflow)
93-
)
90+
matches!(self.trap_code(err), Some(wasmi::TrapCode::StackOverflow))
9491
}
9592
}
9693

9794
/// Converts `wasmi` trap code to `wasmtime` trap code.
98-
fn wasmi_to_wasmtime_trap_code(trap: wasmi::core::TrapCode) -> Trap {
99-
use wasmi::core::TrapCode;
95+
fn wasmi_to_wasmtime_trap_code(trap: wasmi::TrapCode) -> Trap {
96+
use wasmi::TrapCode;
10097
match trap {
10198
TrapCode::UnreachableCodeReached => Trap::UnreachableCodeReached,
10299
TrapCode::MemoryOutOfBounds => Trap::MemoryOutOfBounds,
@@ -174,9 +171,9 @@ impl From<&DiffValue> for wasmi::Val {
174171
match *v {
175172
DiffValue::I32(n) => WasmiValue::I32(n),
176173
DiffValue::I64(n) => WasmiValue::I64(n),
177-
DiffValue::F32(n) => WasmiValue::F32(wasmi::core::F32::from_bits(n)),
178-
DiffValue::F64(n) => WasmiValue::F64(wasmi::core::F64::from_bits(n)),
179-
DiffValue::V128(n) => WasmiValue::V128(wasmi::core::V128::from(n)),
174+
DiffValue::F32(n) => WasmiValue::F32(wasmi::F32::from_bits(n)),
175+
DiffValue::F64(n) => WasmiValue::F64(wasmi::F64::from_bits(n)),
176+
DiffValue::V128(n) => WasmiValue::V128(wasmi::V128::from(n)),
180177
DiffValue::FuncRef { null } => {
181178
assert!(null);
182179
WasmiValue::default(wasmi::ValType::FuncRef)

0 commit comments

Comments
 (0)