Skip to content

fuzz: remove unnecessary internal headers from wasm_mutator_fuzz#4865

Merged
lum1n0us merged 1 commit intobytecodealliance:mainfrom
OwenSanzas:fix/remove-internal-headers-wasm-mutator-fuzz
Mar 6, 2026
Merged

fuzz: remove unnecessary internal headers from wasm_mutator_fuzz#4865
lum1n0us merged 1 commit intobytecodealliance:mainfrom
OwenSanzas:fix/remove-internal-headers-wasm-mutator-fuzz

Conversation

@OwenSanzas
Copy link
Contributor

Summary

Remove unnecessary internal header includes from the wasm_mutator_fuzz fuzz harness (tests/fuzz/wasm-mutator-fuzz/wasm-mutator/wasm_mutator_fuzz.cc).

Changes

Remove two internal headers that are not needed:

  • wasm_runtime_common.h (core/iwasm/common/) — internal runtime implementation header not intended for external use.
  • bh_read_file.h (core/shared/utils/uncommon/) — internal utility header whose functions (bh_read_file_to_buffer) are never called in this fuzzer (data comes from libFuzzer's input buffer).

All runtime APIs actually used by the harness (wasm_runtime_init, wasm_runtime_load, wasm_runtime_instantiate, wasm_runtime_call_wasm_a, wasm_runtime_get_export_count, wasm_runtime_get_export_type, wasm_func_type_get_param_count, wasm_func_type_get_param_valkind, etc.) are declared in the public wasm_export.h header.

Verification

Built and tested the modified harness in OSS-Fuzz for all three build targets (classic-interp, fast-interp, llvm-jit):

  • Build: compiles successfully for all 3 targets.
  • Fuzzing: identical edge coverage (383 edges) with the same seed corpus.
  • Code coverage: identical across all metrics (regions, functions, lines, branches).
Metric Before After
Regions 3.91% 3.91%
Functions 5.65% 5.65%
Lines 4.19% 4.19%
Branches 3.33% 3.33%

Remove `wasm_runtime_common.h` and `bh_read_file.h` includes from the
wasm_mutator_fuzz harness. All runtime APIs used by this fuzzer
(wasm_runtime_init, wasm_runtime_load, wasm_runtime_instantiate,
wasm_runtime_call_wasm_a, wasm_runtime_get_export_count, etc.) are
declared in the public `wasm_export.h` header.

- `wasm_runtime_common.h` (core/iwasm/common/) is an internal
  implementation header not intended for external use.
- `bh_read_file.h` (core/shared/utils/uncommon/) is an internal
  utility header whose functions are never called in this fuzzer.

Verified that the modified harness compiles and runs correctly for all
three build targets (classic-interp, fast-interp, llvm-jit) with
identical code coverage.
@lum1n0us lum1n0us merged commit fe5276a into bytecodealliance:main Mar 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants