Skip to content

Commit

Permalink
Add workaround for issue #2187 where memory type has 65536 pages.
Browse files Browse the repository at this point in the history
Detect and ignore more errors from singlepass about multi-value returns.
  • Loading branch information
nlewycky committed Mar 16, 2021
1 parent d781b3e commit 40fcc04
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions fuzz/fuzz_targets/jit_cranelift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ impl Config for NoImportsConfig {
fn max_imports(&self) -> usize {
0
}
fn max_memory_pages(&self) -> u32 {
// https://github.com/wasmerio/wasmer/issues/2187
65535
}
}

fuzz_target!(|module: ConfiguredModule<NoImportsConfig>| {
Expand Down
5 changes: 4 additions & 1 deletion fuzz/fuzz_targets/jit_llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ impl Config for NoImportsConfig {
fn max_imports(&self) -> usize {
0
}
fn max_memory_pages(&self) -> u32 {
// https://github.com/wasmerio/wasmer/issues/2187
65535
}
}

fuzz_target!(|module: ConfiguredModule<NoImportsConfig>| {
let wasm_bytes = module.to_bytes();

let mut compiler = LLVM::default();
compiler.canonicalize_nans(true);
compiler.enable_verifier();
Expand Down
9 changes: 7 additions & 2 deletions fuzz/fuzz_targets/jit_singlepass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ impl Config for NoImportsConfig {
fn max_imports(&self) -> usize {
0
}
fn max_memory_pages(&self) -> u32 {
// https://github.com/wasmerio/wasmer/issues/2187
65535
}
}

fuzz_target!(|module: ConfiguredModule<NoImportsConfig>| {
Expand All @@ -23,7 +27,7 @@ fuzz_target!(|module: ConfiguredModule<NoImportsConfig>| {
Ok(m) => m,
Err(e) => {
let error_message = format!("{}", e);
if error_message.contains("Validation error: invalid result arity: func type returns multiple values") || error_message.contains("Validation error: blocks, loops, and ifs accept no parameters when multi-value is not enabled") {
if error_message.contains("Validation error: invalid result arity: func type returns multiple values") || error_message.contains("Validation error: blocks, loops, and ifs accept no parameters when multi-value is not enabled") || error_message.contains("multi-value returns not yet implemented") {
return;
}
panic!("{}", e);
Expand All @@ -33,7 +37,8 @@ fuzz_target!(|module: ConfiguredModule<NoImportsConfig>| {
Ok(_) => {}
Err(e) => {
let error_message = format!("{}", e);
if error_message
if
error_message
.contains("RuntimeError: memory out of bounds: data segment does not fit")
|| error_message
.contains("RuntimeError: table out of bounds: elements segment does not fit")
Expand Down
4 changes: 4 additions & 0 deletions fuzz/fuzz_targets/native_cranelift.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ impl Config for NoImportsConfig {
fn max_imports(&self) -> usize {
0
}
fn max_memory_pages(&self) -> u32 {
// https://github.com/wasmerio/wasmer/issues/2187
65535
}
}

fuzz_target!(|module: ConfiguredModule<NoImportsConfig>| {
Expand Down

0 comments on commit 40fcc04

Please sign in to comment.