TianlongLiang 14d84eca0b fix a wamrc compile warning, and enable system include flag for third-party libraries to suppresses corresponding compile warnings (#4875) 1 ay önce
..
aot-compiler db246776ec fix: use copy of input for wasm_runtime_load to fix overwrites-const-input in fuzz (#4869) 1 ay önce
common 9e4aa9c850 fuzzing: reject non-wasm files quickly and execute aot after compilation (#4780) 1 ay önce
wasm-mutator db246776ec fix: use copy of input for wasm_runtime_load to fix overwrites-const-input in fuzz (#4869) 1 ay önce
.env a2f3c7298f Add wasm-mutator-fuzz test (#3420) 1 yıl önce
.gitignore a2f3c7298f Add wasm-mutator-fuzz test (#3420) 1 yıl önce
CMakeLists.txt 14d84eca0b fix a wamrc compile warning, and enable system include flag for third-party libraries to suppresses corresponding compile warnings (#4875) 1 ay önce
README.md a75dc9be51 Remove local fuzzing server (#4729) 5 ay önce
clang_toolchain.cmake 791e60f533 feat(fuzz): add a new fuzzing target about aot compiler (#4121) 1 yıl önce
sanitizer_flags.cmake 9e4aa9c850 fuzzing: reject non-wasm files quickly and execute aot after compilation (#4780) 1 ay önce
smith_wasm.sh 257d475293 update wasm-tool smith generation parameters for improved testing (#4779) 3 ay önce

README.md

WAMR fuzz test framework

Install wasm-tools

Download the release suitable for your specific platform from https://github.com/bytecodealliance/wasm-tools/releases/latest, unpack it, and add the executable wasm-tools to the PATH. Then, you should be able to verify that the installation was successful by using the following command:

$ wasm-tools --version
# Or learn subcommands with
$ wasm-tools help

Install clang Toolchain

Refer to: https://apt.llvm.org/ and ensure that you have clang installed.

$ clang --version

$ clang++ --version

Build

# Without custom mutator (libfuzzer modify the buffer randomly)
$ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=./clang_toolchain.cmake -DLLVM_DIR=<llvm_install_dir>/lib/cmake/llvm

# TBC: if `wasm-tools mutate` is supported or not
# Or With custom mutator (wasm-tools mutate)
$ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=./clang_toolchain.cmake -DLLVM_DIR=<llvm_install_dir>/lib/cmake/llvm -DCUSTOM_MUTATOR=1

# Then
$ cmake --build build

Manually generate wasm file in build

# wasm-tools smith generate some valid wasm file
# The generated wasm file is in corpus_dir under build
# N - Number of files to be generated
$ ./smith_wasm.sh N

# running
``` bash
$ ./build/wasm-mutator/wasm_mutator_fuzz ./build/CORPUS_DIR

$ ./build/aot-compiler/aot_compiler_fuzz ./build/CORPUS_DIR