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

Project functions overview

The following table shows data about each function in the project. The functions included in this table correspond to all functions that exist in the executables of the fuzzers. As such, there may be functions that are from third-party libraries.

For further technical details on the meaning of columns in the below table, please see the Glossary .

Func name Functions filename Args Function call depth Reached by Fuzzers Runtime reached by Fuzzers Combined 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

Fuzzer details

Fuzzer: server_fuzzer

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 86 23.1%
gold [1:9] 14 3.76%
yellow [10:29] 10 2.68%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 262 70.4%
All colors 372 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
62 62 3 :

['_ZNSt3__110unique_ptrIN7httplib6detail11MatcherBaseENS_14default_deleteIS3_EEEC2B8ne180100INS2_17PathParamsMatcherENS4_IS8_EEvvEEONS0_IT_T0_EE', '_ZN7httplib6detail11make_uniqueINS0_17PathParamsMatcherEJRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEEEENS3_9enable_ifIXntsr3std8is_arrayIT_EE5valueENS3_10unique_ptrISD_NS3_14default_deleteISD_EEEEE4typeEDpOT0_', 'std::__1::unique_ptr >::~unique_ptr[abi:ne180100]()']

62 62 httplib::Server::make_matcher(std::__1::basic_string ,std::__1::allocator >const&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:6363
58 58 2 :

['httplib::detail::get_multipart_ranges_data_length(httplib::Request const&, std::__1::basic_string , std::__1::allocator > const&, std::__1::basic_string , std::__1::allocator > const&, unsigned long)', 'std::__1::function ::operator bool[abi:ne180100]() const']

58 379 httplib::Server::apply_ranges(httplib::Requestconst&,httplib::Response&,std::__1::basic_string ,std::__1::allocator >&,std::__1::basic_string ,std::__1::allocator >&)const call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:7191
4 4 1 :

['httplib::detail::skip_content_with_length(httplib::Stream&, unsigned long)']

4 4 httplib::detail::read_content (httplib::Stream&,httplib::Request&,unsignedlong,int&,std::__1::function ,std::__1::function ,bool)::{lambda(std::__1::function const&)#1}::operator()(std::__1::function const&)const call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:4589
0 0 1 :

['std::__1::function ::operator()(httplib::Request const&, httplib::Response&) const']

108 4862 httplib::Server::process_request(httplib::Stream&,std::__1::basic_string ,std::__1::allocator >const&,int,std::__1::basic_string ,std::__1::allocator >const&,int,bool,bool&,std::__1::function const&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:7369
0 0 None 8 1577 httplib::Server::process_request(httplib::Stream&,std::__1::basic_string ,std::__1::allocator >const&,int,std::__1::basic_string ,std::__1::allocator >const&,int,bool,bool&,std::__1::function const&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:7433
0 0 None 4 370 httplib::detail::MultipartFormDataParser::parse(charconst*,unsignedlong,std::__1::function const&,std::__1::function const&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:5050
0 0 None 4 370 httplib::detail::MultipartFormDataParser::parse(charconst*,unsignedlong,std::__1::function const&,std::__1::function const&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:5092
0 0 None 4 370 httplib::detail::MultipartFormDataParser::parse(charconst*,unsignedlong,std::__1::function const&,std::__1::function const&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:5111
0 0 None 2 459 httplib::Server::routing(httplib::Request&,httplib::Response&,httplib::Stream&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:7106
0 0 None 2 459 httplib::Server::routing(httplib::Request&,httplib::Response&,httplib::Stream&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:7112
0 0 None 2 459 httplib::Server::routing(httplib::Request&,httplib::Response&,httplib::Stream&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:7118
0 0 None 2 459 httplib::Server::routing(httplib::Request&,httplib::Response&,httplib::Stream&) call site: 00000 /src/cpp-httplib/test/fuzzing/../../httplib.h:7124

Runtime coverage analysis

Covered functions
179
Functions that are reachable but not covered
98
Reachable functions
328
Percentage of reachable functions covered
70.12%
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/cpp-httplib/test/fuzzing/server_fuzzer.cc 4
/src/cpp-httplib/test/fuzzing/../../httplib.h 153

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
httplib::Server::read_content_core(httplib::Stream&,httplib::Request&,httplib::Response&,std::__1::function ,std::__1::function ,std::__1::function )const::{lambda(charconst*,unsignedlong,unsignedlong,unsignedlong)#1}::operator()(charconst*,unsignedlong,unsignedlong,unsignedlong)const /src/cpp-httplib/test/fuzzing/../../httplib.h 5 ['N/A', 'N/A', 'size_t', 'size_t', 'size_t'] 6 0 36 3 2 76 0 299 198
LLVMFuzzerInitialize /src/cpp-httplib/test/fuzzing/server_fuzzer.cc 2 ['N/A', 'N/A'] 6 0 201 34 23 33 0 137 137
httplib::ClientImpl::create_and_connect_socket(httplib::ClientImpl::Socket&,httplib::Error&) /src/cpp-httplib/test/fuzzing/../../httplib.h 3 ['N/A', 'N/A', 'N/A'] 9 0 46 6 3 54 0 123 119
httplib::Server::process_and_close_socket(int) /src/cpp-httplib/test/fuzzing/../../httplib.h 2 ['N/A', 'int'] 14 0 112 11 8 364 0 1691 78
httplib::detail::write_content_chunked ,std::__1::allocator >const&,std::__1::basic_string ,std::__1::allocator >const&)::{lambda()#1},httplib::detail::compressor>(httplib::Stream&,std::__1::function const&,httplib::Server::write_content_with_provider(httplib::Stream&,httplib::Requestconst&,httplib::Response&,std::__1::basic_string ,std::__1::allocator >const&,std::__1::basic_string ,std::__1::allocator >const&)::{lambda()#1}const&,httplib::detail::compressor&,httplib::Error&)::{lambda(std::__1::unordered_multimap ,std::__1::allocator >,std::__1::basic_string ,std::__1::allocator >,httplib::detail::case_ignore::hash,std::__1::unordered_multimap::equal_to,std::__1::allocator ,std::__1::allocator >const,std::__1::basic_string ,std::__1::allocator >>>>const&)#1}::operator()(std::__1::unordered_multimap ,std::__1::allocator >,std::__1::basic_string ,std::__1::allocator >,httplib::detail::case_ignore::hash,std::__1::unordered_multimap::equal_to,std::__1::allocator ,std::__1::allocator >const,std::__1::basic_string ,std::__1::allocator >>>>const)const /src/cpp-httplib/test/fuzzing/../../httplib.h 2 ['N/A', 'N/A'] 2 0 22 3 2 10 0 69 63
httplib::detail::SocketStream::write(charconst*,unsignedlong) /src/cpp-httplib/test/fuzzing/../../httplib.h 3 ['N/A', 'N/A', 'size_t'] 8 0 40 6 3 38 0 57 41

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

Functions statically reachable by fuzzers
65.0%
245 / 376
Cyclomatic complexity statically reachable by fuzzers
80.0%
2167 / 2715

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 Runtime reached by Fuzzers Combined 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

Fuzz engine guidance

This sections provides heuristics that can be used as input to a fuzz engine when running a given fuzz target. The current focus is on providing input that is usable by libFuzzer.

/src/cpp-httplib/test/fuzzing/server_fuzzer.cc

Dictionary

Use this with the libFuzzer -dict=DICT.file flag


Fuzzer function priority

Use one of these functions as input to libfuzzer with flag: -focus_function name

-focus_function=['httplib::Server::routing(httplib::Request&, httplib::Response&, httplib::Stream&)', 'bool httplib::detail::process_multipart_ranges_data, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&)::{lambda()#1}>(httplib::Stream&, httplib::Request const&, httplib::Response&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long, httplib::Server::write_content_with_provider(httplib::Stream&, httplib::Request const&, httplib::Response&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&)::{lambda()#1} const&)::{lambda(std::__1::basic_string, std::__1::allocator > const&)#1}, httplib::detail::write_multipart_ranges_data<{lambda()#1}>(httplib::Stream&, httplib::Request const&, httplib::Response&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long, {lambda()#1} const)::{lambda(std::__1::basic_string, std::__1::allocator > const&)#2}, httplib::detail::write_multipart_ranges_data<{lambda()#1}>(httplib::Stream&, httplib::Request const&, httplib::Response&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long, {lambda()#1} const)::{lambda(unsigned long, unsigned long)#1}>(httplib::Request const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long, httplib::Server::write_content_with_provider(httplib::Stream&, httplib::Request const&, httplib::Response&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&)::{lambda()#1}, httplib::detail::write_multipart_ranges_data<{lambda()#1}>(httplib::Stream&, httplib::Request const&, httplib::Response&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long, {lambda()#1} const)::{lambda(std::__1::basic_string, std::__1::allocator > const&)#2}, httplib::detail::write_multipart_ranges_data<{lambda()#1}>(httplib::Stream&, httplib::Request const&, httplib::Response&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long, {lambda()#1} const)::{lambda(unsigned long, unsigned long)#1})', 'httplib::Server::process_request(httplib::Stream&, std::__1::basic_string, std::__1::allocator > const&, int, std::__1::basic_string, std::__1::allocator > const&, int, bool, bool&, std::__1::function const&)', 'httplib::Server::write_response_core(httplib::Stream&, bool, httplib::Request const&, httplib::Response&, bool)', 'bool httplib::detail::process_multipart_ranges_data, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long)::{lambda(std::__1::basic_string, std::__1::allocator > const&)#1}, httplib::detail::get_multipart_ranges_data_length(httplib::Request const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long)::{lambda(std::__1::basic_string, std::__1::allocator > const&)#2}, httplib::detail::get_multipart_ranges_data_length(httplib::Request const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long)::{lambda(unsigned long, unsigned long)#1}>(httplib::Request const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long, httplib::detail::get_multipart_ranges_data_length(httplib::Request const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long)::{lambda(std::__1::basic_string, std::__1::allocator > const&)#1}, httplib::detail::get_multipart_ranges_data_length(httplib::Request const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long)::{lambda(std::__1::basic_string, std::__1::allocator > const&)#2}, httplib::detail::get_multipart_ranges_data_length(httplib::Request const&, std::__1::basic_string, std::__1::allocator > const&, std::__1::basic_string, std::__1::allocator > const&, unsigned long)::{lambda(unsigned long, unsigned long)#1})', 'httplib::detail::get_range_offset_and_length(std::__1::pair, unsigned long)', 'httplib::Server::routing(httplib::Request&, httplib::Response&, httplib::Stream&)', 'httplib::Server::process_request(httplib::Stream&, std::__1::basic_string, std::__1::allocator > const&, int, std::__1::basic_string, std::__1::allocator > const&, int, bool, bool&, std::__1::function const&)', 'LLVMFuzzerTestOneInput', 'httplib::Request::get_header_value(std::__1::basic_string, std::__1::allocator > const&, char const*, unsigned long) const']