Skip to content

Commit eb3d5e6

Browse files
authored
Fix another wasm-mutate invalid module (#1797)
Return a first-class error instead of generating an invalid module during loop unrolling in wasm-mutate when unsupported opcodes are encountered.
1 parent ae473e3 commit eb3d5e6

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

crates/wasm-mutate/src/mutators/codemotion/loop_unrolling.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
},
1919
OperatorAndByteOffset,
2020
},
21-
WasmMutate,
21+
Error, WasmMutate,
2222
};
2323

2424
/// This mutator selects a random `loop` construction in a function and tries to unroll it.
@@ -110,6 +110,14 @@ impl LoopUnrollWriter {
110110

111111
to_fix.insert(idx, Instruction::BrTable(jmpfix.into(), def));
112112
}
113+
114+
Operator::BrOnCast { .. }
115+
| Operator::BrOnCastFail { .. }
116+
| Operator::BrOnNull { .. }
117+
| Operator::BrOnNonNull { .. } => {
118+
log::info!("unsupported operator {op:?}");
119+
return Err(Error::no_mutations_applicable());
120+
}
113121
_ => {}
114122
}
115123
}

0 commit comments

Comments
 (0)