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

Fuzzer details

Fuzzer: bs4_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 330 73.9%
gold [1:9] 0 0.0%
yellow [10:29] 0 0.0%
greenyellow [30:49] 0 0.0%
lawngreen 50+ 116 26.0%
All colors 446 100

Fuzz blockers

The following nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
115 320 bs4.element.SoupStrainer._matches call site: 00320 bs4.element.SoupStrainer._matches
67 95 bs4.element.SoupStrainer._normalize_search_value call site: 00095 bs4.BeautifulSoup.decode
44 204 bs4.element.SoupStrainer._matches call site: 00204 bs4.element.SoupStrainer._normalize_search_value
22 34 bs4.BeautifulSoup.__init__ call site: 00034 bs4.BeautifulSoup._check_markup_is_url
12 10 bs4.BeautifulSoup.__init__ call site: 00010 bs4.builder.TreeBuilderRegistry.lookup
9 190 bs4.element.SoupStrainer.search call site: 00190 bs4.element.SoupStrainer.search
8 86 ...bs4_fuzzer.TestOneInput call site: 00086 bs4.element.PageElement._find_all
7 179 bs4.element.PageElement._find_all call site: 00179 bs4.element.ResultSet.__init__
5 57 bs4.BeautifulSoup._check_markup_is_url call site: 00057 bs4.BeautifulSoup.reset
5 63 bs4.BeautifulSoup.reset call site: 00063 bs4.element.PageElement.setup
5 172 bs4.element.SoupStrainer.__init__ call site: 00172 bs4.element.SoupStrainer._normalize_search_value
4 81 bs4.BeautifulSoup._linkage_fixer call site: 00081 bs4.BeautifulSoup.popTag

Runtime coverage analysis

Covered functions
321
Functions that are reachable but not covered
284
Reachable functions
306
Percentage of reachable functions covered
7.19%
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.
Warning: The number of covered functions are larger than the number of reachable functions. This means that there are more functions covered at runtime than are extracted using static analysis. This is likely a result of the static analysis component failing to extract the right call graph or the coverage runtime being compiled with sanitizers in code that the static analysis has not analysed. This can happen if lto/gold is not used in all places that coverage instrumentation is used.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
/ 1
...bs4_fuzzer 8
bs4 38
bs4.builder 7
bs4.element 265

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
bs4.element.Tag.select bs4.element 5 ['N/A', 'N/A', 'N/A', 'N/A', 'N/A'] 20 0 1 3 4 155 1 598 577
bs4.element.Tag.decode bs4.element 4 ['N/A', 'N/A', 'N/A', 'N/A'] 6 0 10 16 9 25 0 93 76
bs4.dammit.EncodingDetector.encodings bs4.dammit 1 ['N/A'] 2 0 7 8 6 17 0 60 48
bs4.dammit.UnicodeDammit.__init__ bs4.dammit 8 ['N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A', 'N/A'] 3 0 2 6 5 17 1 59 41
bs4.element.PageElement.insert bs4.element 3 ['N/A', 'N/A', 'N/A'] 4 0 4 14 9 11 13 51 39

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

Functions statically reachable by fuzzers
25.0%
134 / 542
Cyclomatic complexity statically reachable by fuzzers
32.0%
611 / 1923

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