Fuzz introspector
For issues and ideas: https://github.com/ossf/fuzz-introspector/issues

Fuzzer details

Fuzzer: fuzz_db

Call tree

The calltree shows the control flow of the fuzzer. This is overlaid with coverage information to display how much of the potential code a fuzzer can reach is in fact covered at runtime. In the following there is a link to a detailed calltree visualisation as well as a bitmap showing a high-level view of the calltree. For further information about these topics please see the glossary for full calltree and calltree overview

Call tree overview bitmap:

The distribution of callsites in terms of coloring is
Color Runtime hitcount Callsite count Percentage
red 0 278 22.2%
gold [1:9] 9 0.71%
yellow [10:29] 1 0.07%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 963 76.9%
All colors 1251 100

Fuzz blockers

The followings are the branches where fuzzer fails to bypass.

Unique non-covered Complexity Unique Reachable Complexities Unique Reachable Functions All non-covered Complexity All Reachable Complexity Function Name Function Callsite Blocked Branch
142 325 18 :

['operator new(unsigned long)', 'leveldb::BytewiseComparator()', 'leveldb::Status::~Status()', 'leveldb::operator==(leveldb::Slice const&, leveldb::Slice const&)', 'leveldb::Block::NewIterator(leveldb::Comparator const*)', 'leveldb::Block::~Block()', 'leveldb::Status::ok() const', 'leveldb::Table::ReadFilter(leveldb::Slice const&)', 'leveldb::Slice::Slice(std::__1::basic_string , std::__1::allocator > const&)', 'operator delete(void*)', 'leveldb::Footer::metaindex_handle() const', 'std::__1::basic_string , std::__1::allocator >::append(char const*)', 'std::__1::basic_string , std::__1::allocator >::~basic_string()', 'leveldb::ReadOptions::ReadOptions()', 'leveldb::Block::Block(leveldb::BlockContents const&)', 'leveldb::ReadBlock(leveldb::RandomAccessFile*, leveldb::ReadOptions const&, leveldb::BlockHandle const&, leveldb::BlockContents*)', 'std::__1::basic_string , std::__1::allocator >::basic_string (char const*)', 'leveldb::BlockContents::BlockContents()']

142 325 leveldb::Table::ReadMeta(leveldb::Footerconst&) call site: 00000 /src/leveldb/table/table.cc:83
120 204 6 :

['std::__1::basic_string , std::__1::allocator >::assign(char const*, unsigned long)', 'leveldb::log::Reader::ReportCorruption(unsigned long, char const*)', 'std::__1::basic_string , std::__1::allocator >::clear()', 'std::__1::basic_string , std::__1::allocator >::size() const', 'leveldb::log::Reader::ReadPhysicalRecord(leveldb::Slice*)', 'std::__1::basic_string , std::__1::allocator >::empty() const']

120 228 leveldb::log::Reader::ReadRecord(leveldb::Slice*,std::__1::basic_string ,std::__1::allocator >*) call site: 00000 /src/leveldb/db/log_reader.cc:133
42 56 2 :

['leveldb::VersionSet::NumLevelBytes(int) const', 'leveldb::VersionSet::NumLevelFiles(int) const']

42 60 leveldb::DBImpl::GetProperty(leveldb::Sliceconst&,std::__1::basic_string ,std::__1::allocator >*) call site: 00000 /src/leveldb/db/db_impl.cc:1423
41 107 10 :

['operator new(unsigned long)', 'leveldb::Log(leveldb::Logger*, char const*, ...)', 'leveldb::Status::~Status()', 'std::__1::basic_string , std::__1::allocator >::~basic_string()', 'leveldb::log::Writer::Writer(leveldb::WritableFile*, unsigned long)', 'leveldb::ParseFileName(std::__1::basic_string , std::__1::allocator > const&, unsigned long*, leveldb::FileType*)', 'leveldb::Status::ToString() const', 'std::__1::basic_string , std::__1::allocator >::c_str() const', 'leveldb::Status::ok() const', 'leveldb::TargetFileSize(leveldb::Options const*)']

41 107 leveldb::VersionSet::ReuseManifest(std::__1::basic_string ,std::__1::allocator >const&,std::__1::basic_string ,std::__1::allocator >const&) call site: 00000 /src/leveldb/db/version_set.cc:996
21 30 5 :

['leveldb::Slice::Slice(char const*)', 'leveldb::Status::~Status()', 'leveldb::Status::Corruption(leveldb::Slice const&, leveldb::Slice const&)', 'leveldb::Slice::Slice()', 'leveldb::NewErrorIterator(leveldb::Status const&)']

21 30 leveldb::Block::NewIterator(leveldb::Comparatorconst*) call site: 00000 /src/leveldb/table/block.cc:281
16 16 1 :

['leveldb::log::Reader::SkipToInitialBlock()']

136 248 leveldb::log::Reader::ReadRecord(leveldb::Slice*,std::__1::basic_string ,std::__1::allocator >*) call site: 00000 /src/leveldb/db/log_reader.cc:57
15 15 1 :

['leveldb::NewEmptyIterator()']

15 15 leveldb::Block::NewIterator(leveldb::Comparatorconst*) call site: 00000 /src/leveldb/table/block.cc:285
15 15 1 :

['leveldb::NewEmptyIterator()']

15 15 leveldb::NewMergingIterator(leveldb::Comparatorconst*,leveldb::Iterator**,int) call site: 00000 /src/leveldb/table/merger.cc:182
10 18 4 :

['leveldb::Status::Corruption(leveldb::Slice const&, leveldb::Slice const&)', 'leveldb::Status::operator=(leveldb::Status&&)', 'leveldb::Slice::Slice()', 'leveldb::Slice::Slice(char const*)']

10 252 leveldb::VersionSet::Recover(bool*) call site: 00000 /src/leveldb/db/version_set.cc:955
10 14 2 :

['leveldb::Status::Corruption(leveldb::Slice const&, leveldb::Slice const&)', 'leveldb::Slice::Slice(char const*)']

10 16 leveldb::Table::Open(leveldb::Optionsconst&,leveldb::RandomAccessFile*,unsignedlong,leveldb::Table**) call site: 00000 /src/leveldb/table/table.cc:41
4 29 5 :

['leveldb::(anonymous namespace)::PosixLockTable::Remove(std::__1::basic_string , std::__1::allocator > const&)', '__errno_location', 'std::__1::basic_string , std::__1::allocator > std::__1::operator+ , std::__1::allocator >(char const*, std::__1::basic_string , std::__1::allocator > const&)', 'close', 'leveldb::(anonymous namespace)::PosixError(std::__1::basic_string , std::__1::allocator > const&, int)']

4 29 leveldb::(anonymousnamespace)::PosixEnv::LockFile(std::__1::basic_string ,std::__1::allocator >const&,leveldb::FileLock**) call site: 00000 /src/leveldb/util/env_posix.cc:669
4 28 5 :

['read', '__errno_location', 'leveldb::Status::~Status()', 'leveldb::Status::operator=(leveldb::Status&&)', 'leveldb::(anonymous namespace)::PosixError(std::__1::basic_string , std::__1::allocator > const&, int)']

4 30 leveldb::(anonymousnamespace)::PosixSequentialFile::Read(unsignedlong,leveldb::Slice*,char*) call site: 00000 /src/leveldb/util/env_posix.cc:146

Runtime coverage analysis

Covered functions
583
Functions that are reachable but not covered
123
Reachable functions
786
Percentage of reachable functions covered
84.35%
NB: The sum of covered functions and functions that are reachable but not covered need not be equal to Reachable functions . This is because the reachability analysis is an approximation and thus at runtime some functions may be covered that are not included in the reachability analysis. This is a limitation of our static analysis capabilities.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/src/leveldb/build/../fuzz_db.cc 3
/src/leveldb/util/options.cc 1
/src/leveldb/util/comparator.cc 3
/src/leveldb/./util/no_destructor.h 1
/src/leveldb/include/leveldb/comparator.h 2
/src/leveldb/util/env_posix.cc 6
/src/leveldb/util/env.cc 5
/src/leveldb/./port/port_stdcxx.h 13
/src/leveldb/db/db_impl.cc 30
/src/leveldb/include/leveldb/db.h 2
/src/leveldb/./db/dbformat.h 17
/src/leveldb/include/leveldb/filter_policy.h 1
/src/leveldb/include/leveldb/status.h 13
/src/leveldb/db/filename.cc 11
/src/leveldb/util/cache.cc 6
/src/leveldb/include/leveldb/cache.h 1
/src/leveldb/db/table_cache.cc 6
/src/leveldb/db/write_batch.cc 9
/src/leveldb/./db/snapshot.h 4
/src/leveldb/db/version_set.cc 52
/src/leveldb/./db/version_set.h 14
/src/leveldb/./db/version_edit.h 13
/src/leveldb/./db/db_impl.h 3
/src/leveldb/db/version_edit.cc 5
/src/leveldb/include/leveldb/slice.h 11
/src/leveldb/db/log_writer.cc 6
/src/leveldb/./util/crc32c.h 3
/src/leveldb/util/crc32c.cc 4
/src/leveldb/./util/coding.h 5
/src/leveldb/util/coding.cc 12
/src/leveldb/util/status.cc 3
/src/leveldb/./db/log_reader.h 1
/src/leveldb/db/log_reader.cc 7
/src/leveldb/util/logging.cc 3
/src/leveldb/db/memtable.cc 5
/src/leveldb/./db/memtable.h 5
/src/leveldb/util/arena.cc 4
/src/leveldb/./db/skiplist.h 6
/src/leveldb/./util/random.h 1
/src/leveldb/include/leveldb/write_batch.h 1
/src/leveldb/./util/arena.h 1
/src/leveldb/table/iterator.cc 5
/src/leveldb/db/builder.cc 1
/src/leveldb/table/table_builder.cc 13
/src/leveldb/table/block_builder.cc 5
/src/leveldb/table/filter_block.cc 6
/src/leveldb/./table/format.h 11
/src/leveldb/include/leveldb/table_builder.h 1
/src/leveldb/table/format.cc 5
/src/leveldb/./table/block_builder.h 2
/src/leveldb/./table/filter_block.h 1
/src/leveldb/include/leveldb/options.h 2
/src/leveldb/table/table.cc 11
/src/leveldb/table/block.cc 5
/src/leveldb/include/leveldb/table.h 1
/src/leveldb/table/two_level_iterator.cc 2
/src/leveldb/./table/iterator_wrapper.h 4
/src/leveldb/./table/block.h 1
/src/leveldb/include/leveldb/iterator.h 1
/src/leveldb/db/dbformat.cc 5
/src/leveldb/./util/mutexlock.h 2
/src/leveldb/table/merger.cc 2

Analyses and suggestions

Optimal target analysis

Remaining optimal interesting functions

The following table shows a list of functions that are optimal targets. Optimal targets are identified by finding the functions that in combination, yield a high code coverage.

Func name Functions filename Arg count Args Function depth hitcount instr count bb count cyclomatic complexity Reachable functions Incoming references total cyclomatic complexity Unreached complexity
leveldb::DBImpl::Get(leveldb::ReadOptionsconst&,leveldb::Sliceconst&,std::__1::basic_string ,std::__1::allocator >*) /src/leveldb/db/db_impl.cc 5 ['class.std::__1::__libcpp_refstring *', 'class.leveldb::DBImpl *', 'struct.leveldb::ReadOptions *', 'class.FuzzedDataProvider *', 'class.std::__1::basic_string *'] 16 0 144 25 10 667 0 1286 102
leveldb::DBImpl::Write(leveldb::WriteOptionsconst&,leveldb::WriteBatch*) /src/leveldb/db/db_impl.cc 4 ['class.std::__1::__libcpp_refstring *', 'class.leveldb::DBImpl *', 'struct.std::__1::default_delete *', 'class.std::__1::__fs::filesystem::path *'] 17 0 275 44 17 696 0 1310 63
leveldb::(anonymousnamespace)::MemTableInserter::Delete(leveldb::Sliceconst&) /src/leveldb/db/write_batch.cc 2 ['class.leveldb::(anonymous namespace)::MemTableInserter *', 'class.FuzzedDataProvider *'] 8 0 26 3 2 63 0 114 42
leveldb::DBImpl::GetProperty(leveldb::Sliceconst&,std::__1::basic_string ,std::__1::allocator >*) /src/leveldb/db/db_impl.cc 3 ['class.leveldb::DBImpl *', 'class.FuzzedDataProvider *', 'class.std::__1::basic_string *'] 6 0 501 69 26 65 0 111 40
leveldb::Block::Iter::Seek(leveldb::Sliceconst&) /src/leveldb/table/block.cc 2 ['class.leveldb::Block::Iter *', 'class.FuzzedDataProvider *'] 5 0 221 36 14 40 0 77 40
leveldb::(anonymousnamespace)::DBIter::Prev() /src/leveldb/db/db_iter.cc 1 ['class.leveldb::(anonymous namespace)::DBIter *'] 19 0 135 12 5 638 0 1245 37

Implementing fuzzers that target the above functions will improve reachability such that it becomes:

Functions statically reachable by fuzzers
59.0%
456 / 768
Cyclomatic complexity statically reachable by fuzzers
67.0%
1831 / 2744

All functions overview

If you implement fuzzers for these functions, the status of all functions in the project will be:

Func name Functions filename Args Function call depth Reached by Fuzzers Fuzzers runtime hit Func lines hit % I Count BB Count Cyclomatic complexity Functions reached Reached by functions Accumulated cyclomatic complexity Undiscovered complexity

Files and Directories in report

This section shows which files and directories are considered in this report. The main reason for showing this is fuzz introspector may include more code in the reasoning than is desired. This section helps identify if too many files/directories are included, e.g. third party code, which may be irrelevant for the threat model. In the event too much is included, fuzz introspector supports a configuration file that can exclude data from the report. See the following link for more information on how to create a config file: link

Files in report

Source file Reached by Covered by
[] []
/src/leveldb/table/table_builder.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/util/arena.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/env.h [] []
/src/leveldb/util/status.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/table.h ['fuzz_db'] ['fuzz_db']
/usr/include/x86_64-linux-gnu/sys/stat.h [] []
/src/leveldb/table/filter_block.cc ['fuzz_db'] []
/src/leveldb/./util/no_destructor.h ['fuzz_db'] []
/src/leveldb/./util/crc32c.h ['fuzz_db'] []
/usr/local/bin/../include/c++/v1/stdexcept [] []
/src/leveldb/util/coding.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/options.h ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/status.h ['fuzz_db'] ['fuzz_db']
/src/leveldb/./table/filter_block.h ['fuzz_db'] []
/src/leveldb/db/db_impl.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/util/env.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/db/log_writer.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/./db/version_set.h ['fuzz_db'] []
/src/leveldb/./db/db_impl.h ['fuzz_db'] []
/src/leveldb/./util/random.h ['fuzz_db'] []
/src/leveldb/./table/block_builder.h ['fuzz_db'] []
/src/leveldb/include/leveldb/filter_policy.h ['fuzz_db'] []
/src/leveldb/include/leveldb/iterator.h ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/write_batch.h ['fuzz_db'] []
/src/leveldb/./db/write_batch_internal.h [] []
/src/leveldb/table/merger.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/table_builder.h ['fuzz_db'] ['fuzz_db']
/src/leveldb/./db/snapshot.h ['fuzz_db'] []
/src/leveldb/db/log_reader.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/table/iterator.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/table/format.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/db.h ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/slice.h ['fuzz_db'] ['fuzz_db']
/src/leveldb/db/memtable.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/util/comparator.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/build/../fuzz_db.cc ['fuzz_db'] []
/src/leveldb/db/write_batch.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/./util/mutexlock.h ['fuzz_db'] []
/src/leveldb/./util/arena.h ['fuzz_db'] []
/src/leveldb/table/two_level_iterator.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/db/dbformat.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/include/leveldb/cache.h ['fuzz_db'] ['fuzz_db']
/src/leveldb/table/block_builder.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/./db/skiplist.h ['fuzz_db'] []
/src/leveldb/include/leveldb/comparator.h ['fuzz_db'] []
/src/leveldb/./port/port_stdcxx.h ['fuzz_db'] []
/src/leveldb/./db/memtable.h ['fuzz_db'] []
/src/leveldb/./table/iterator_wrapper.h ['fuzz_db'] []
/src/leveldb/db/table_cache.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/db/version_set.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/table/table.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/util/cache.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/util/filter_policy.cc [] []
/src/leveldb/util/hash.cc [] []
/src/leveldb/./util/coding.h ['fuzz_db'] []
/src/leveldb/./table/block.h ['fuzz_db'] []
/src/leveldb/./util/posix_logger.h [] []
/src/leveldb/./db/log_reader.h ['fuzz_db'] []
/src/leveldb/util/logging.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/util/env_posix.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/table/block.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/db/version_edit.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/util/crc32c.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/./table/format.h ['fuzz_db'] []
/src/leveldb/./db/version_edit.h ['fuzz_db'] []
/src/leveldb/db/filename.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/db/builder.cc ['fuzz_db'] ['fuzz_db']
/src/leveldb/db/db_iter.cc [] []
/src/leveldb/./db/dbformat.h ['fuzz_db'] []
/src/leveldb/util/options.cc ['fuzz_db'] ['fuzz_db']

Directories in report

Directory
/src/leveldb/table/
/src/leveldb/util/
/src/leveldb/build/../
/usr/include/x86_64-linux-gnu/sys/
/src/leveldb/./db/
/usr/local/bin/../include/c++/v1/
/src/leveldb/./port/
/src/leveldb/./util/
/src/leveldb/include/leveldb/
/src/leveldb/db/
/src/leveldb/./table/