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.

A sibling dbwrapper_threaded target uses a bare memenv so LevelDB's real
background thread runs, exercising force_compact and threaded compaction
paths that the deterministic variant cannot reach.

Adds an implicit-integer-sign-change suppression for
BytewiseComparatorImpl::FindShortSuccessor (leveldb/util/comparator.cc:58)
to the test ubsan suppressions list. LevelDB's bytewise comparator
implicitly converts a signed `char` byte to `uint8_t` there. The path
is only reached when compaction picks an SST boundary key, so it
requires a small enough max_file_size for compaction to fire during
the fuzz run.

Co-authored-by: l0rinc <pap.lorinc@gmail.com>
This commit is contained in:
Andrew Toth
2026-03-21 11:21:27 -04:00
parent 32169c3855
commit b63ef20d54
3 changed files with 327 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ implicit-integer-sign-change:*/include/c++/
implicit-integer-sign-change:*/new_allocator.h
implicit-integer-sign-change:*/qarraydata.h
implicit-integer-sign-change:crc32c/
implicit-integer-sign-change:BytewiseComparatorImpl::FindShortSuccessor
implicit-integer-sign-change:minisketch/
implicit-integer-sign-change:secp256k1/
implicit-signed-integer-truncation:*/include/c++/