Repository navigation
fuzz: add a fuzzer for the C API - #320
Merged
hyperrealm merged 1 commit intoNov 29, 2026
Merged
Conversation
config_read_fuzzer parses a configuration, looks up a setting, sets or adds one float, writes the result and removes that setting. This adds config_api_fuzzer, which drives more of the C API on a parsed tree: typed setters and getters, element access, path lookups, element removal, output formats and options, and a config_write() -> config_read() round trip. Inputs that contain "@include" are skipped, so the fuzzer never opens files. Written output larger than 16 KiB is not read back, so that deeply nested inputs do not time out. The new fuzzer has its own install() line in fuzz/CMakeLists.txt, so it can be taken out of OSS-Fuzz by removing that line. Its seeds are built from tests/testdata in fuzz/build.sh. Follow-up to hyperrealm#319. Signed-off-by: Matías Scatarelli <matiasnada.security@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #319, as agreed there. Thanks for the quick answer, Mark.
This adds
config_api_fuzzernext toconfig_read_fuzzerinfuzz/. The existing fuzzer parses a configuration, looks up a setting, sets or adds one float, writes the result and removes that setting. The new one drives more of the C API on a parsed tree: typed setters and getters, element access, path lookups, element removal, output formats and options, hooks, and aconfig_write()→config_read()round trip.@includeare skipped, so the fuzzer never opens files.install()line infuzz/CMakeLists.txt: removing that line takes it out of OSS-Fuzz.fuzz/build.shbuilds its seeds fromtests/testdataand installs a small dictionary. The existing fuzzer and its build lines are not changed.Testing: with OSS-Fuzz's
infra/helper.py,build_fuzzersandcheck_buildpass with the address and undefined sanitizers (libFuzzer) and with AFL and honggfuzz (address). Short ASan and UBSan runs of the new fuzzer found no crashes.Coverage: in a 7-minute local run the new fuzzer covered 1,109 lines of
lib/libconfig.cand 681 oflib/scanner.c. The public OSS-Fuzz coverage report of November 25 shows 762 and 581 for those files, so it reaches at least about 430 lines oflib/that are not covered there today.Once I am on
auto_ccs(a separate pull request in google/oss-fuzz), I will look at this fuzzer's reports first, as offered in #319.The fuzzer was written and tested with AI tools (Claude), with a separate AI review.