fuzz: target CDBWrapper #34887

pull andrewtoth wants to merge 3 commits into bitcoin:master from andrewtoth:fuzz-dbwrapper changing 5 files +267 −2
  1. andrewtoth commented at 1:12 am on March 21, 2026: contributor

    Inspired by #34866 (comment).

    We currently don’t have a dedicated harness targeting CDBWrapper. OSS-Fuzz has a rudimentary harness for levelDB which fails, so doesn’t appear maintained.

    This PR adds a harness targeting CDBWrapper against an in-memory oracle to verify correctness.

    A DeterministicEnv wraps levelDB’s memenv to eliminate non-determinism by capturing background compaction and running it at fuzzer-chosen points. The fuzzer also controls the cache_bytes and max_file_size sizes so that small values trigger memtable flushes and compaction.

  2. DrahtBot added the label Fuzzing on Mar 21, 2026
  3. DrahtBot commented at 1:12 am on March 21, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #34866 (fuzz: target concurrent leveldb reads by andrewtoth)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. DrahtBot added the label CI failed on Mar 21, 2026
  5. andrewtoth force-pushed on Mar 21, 2026
  6. DrahtBot removed the label CI failed on Mar 21, 2026
  7. dbwrapper: make max_file_size a configurable DBParams field
    Useful for fuzzing different values.
    4ded02817c
  8. dbwrapper: accept optional testing leveldb::Env in DBParams
    Allow callers to inject a custom leveldb::Env via DBParams::testing_env,
    which takes priority over the memory_only in-memory environment. This
    enables fuzz harnesses to supply a deterministic environment.
    ef8f152fbd
  9. andrewtoth force-pushed on Mar 21, 2026
  10. andrewtoth force-pushed on Mar 21, 2026
  11. andrewtoth force-pushed on Mar 21, 2026
  12. DrahtBot added the label CI failed on Mar 22, 2026
  13. andrewtoth force-pushed on Mar 22, 2026
  14. test: add fuzz harness for CDBWrapper
    Introduces a libFuzzer harness that exercises CDBWrapper operations
    against a std::map oracle, with a DeterministicEnv that captures LevelDB
    background compaction for single-threaded determinism.
    30e5ace1c9
  15. andrewtoth force-pushed on Mar 22, 2026
  16. DrahtBot removed the label CI failed on Mar 22, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-03-23 09:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me