Abstract:
WebAssembly is an emerging form of binary compilation target that offers a portable representation and high-performance execution. However, WebAssembly compilers are not bug-free. Wafer is a fuzzing-based tool to test C-to-WebAssembly compilers. In order to generate diverse and comprehensive test cases, Wafer adopts three different code-fuzzing strategies. To solve the test oracle, Wafer compares the behaviors of compiled WebAssembly bytecode to the original C program, which are expected to have consistent behaviors. We applied Wafer to test two widely-adopted C-to-WebAssembly compilers, i.e. Cheerp and Emscripten. Wafer detected 14 new bugs in these compilers. All detected bugs were confirmed by developers. Extensive studies show that Wafer is capable of detecting various types of bugs, and achieves higher coverage than existing tools.