Skip to content

tests: extend fuzz parser coverage - #2537

Merged
michalvasko merged 1 commit into
CESNET:develfrom
BeaCox:fuzz-lyb-schema-mount
Jul 3, 2026
Merged

tests: extend fuzz parser coverage#2537
michalvasko merged 1 commit into
CESNET:develfrom
BeaCox:fuzz-lyb-schema-mount

Conversation

@BeaCox

@BeaCox BeaCox commented Jul 2, 2026

Copy link
Copy Markdown

Summary:

  • add a LYB data parser fuzz target that preserves binary input length via fd-backed parsing
  • add a schema-mount XML data parser fuzz target with runtime extension data and a non-crashing seed
  • allow fuzz targets to build without the unit-test/CMocka dependency and make LibFuzzer targets link sanitizer runtimes correctly
  • avoid terminating the fuzzer process from existing harness setup/allocation failures

Testing:

  • cmake -S . -B build-fuzz-check -G Ninja -DENABLE_TESTS=OFF -DENABLE_FUZZ_TARGETS=ON -DFUZZER=AFL -DCMAKE_BUILD_TYPE=Debug
  • cmake --build build-fuzz-check --target lys_parse_mem_fuzz_harness lyd_parse_mem_xml_fuzz_harness lyd_parse_mem_json_fuzz_harness yang_parse_module_fuzz_harness lyd_parse_lyb_fuzz_harness lyd_parse_schema_mount_xml_fuzz_harness -j2
  • ./build-fuzz-check/lyd_parse_schema_mount_xml_fuzz_harness < tests/fuzz/corpus/lyd_parse_schema_mount_xml/valid-mounted-leaf
  • cmake -S . -B build-fuzz-libfuzzer -G Ninja -DENABLE_TESTS=OFF -DENABLE_FUZZ_TARGETS=ON -DFUZZER=LibFuzzer -DCMAKE_C_COMPILER=clang -DCMAKE_BUILD_TYPE=Release
  • cmake --build build-fuzz-libfuzzer --target lyd_parse_lyb_fuzz_harness lyd_parse_schema_mount_xml_fuzz_harness -j2
  • ASAN_OPTIONS=detect_leaks=0 ./build-fuzz-libfuzzer/lyd_parse_schema_mount_xml_fuzz_harness -runs=1 tests/fuzz/corpus/lyd_parse_schema_mount_xml/valid-mounted-leaf

@michalvasko
michalvasko merged commit b3404d2 into CESNET:devel Jul 3, 2026
13 checks passed
@michalvasko

Copy link
Copy Markdown
Member

Okay, no problem, thanks.

DavidKorczynski pushed a commit to google/oss-fuzz that referenced this pull request Jul 9, 2026
Summary:
- build every fuzz target available in upstream libyang after
CESNET/libyang#2537
- add the new LYB and schema-mount XML fuzz targets to OSS-Fuzz
- package upstream per-target fuzz regression corpora as OSS-Fuzz seed
corpora when present

Testing:
- bash -n projects/libyang/build.sh
- git diff --check
- python3 infra/helper.py build_fuzzers --sanitizer address libyang was
started locally; Docker dependency installation completed, but the image
build stalled while cloning CESNET/libyang and was interrupted before
completion.

Co-authored-by: BeaCox <0xbeac@gmail.com>

@moohamedsalim88-cpu moohamedsalim88-cpu left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MSS

@moohamedsalim88-cpu

Copy link
Copy Markdown

MSS

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.

3 participants