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

Fuzzer details

Fuzzer: magic_fuzzer

Call tree

The following is the call tree with color coding for which functions are hit/not hit. This info is based on the coverage achieved of all fuzzers together and not just this specific fuzzer. We use the following coloring scheme where min/max is an interval [min:max) (max non-inclusive) to color the callsite based on how many times the callsite is covered at run time.
Min Max Color
0 1 red
1 10 gold
10 30 yellow
30 50 greenyellow
50 1000000000000 lawngreen

For further technical details on the call tree overview, please see the Glossary .

The distribution of callsites in terms of coloring is
Color Callsite count Percentage
red 484 49.5%
gold 7 0.71%
yellow 9 0.92%
greenyellow 17 1.74%
lawngreen 460 47.0%
All colors 977 100

Full call tree

The following link provides a visualisation of the full call tree overlaid with coverage information: full call tree

For further technical details on how the call tree is generated, please see the Glossary .

Fuzz blockers

The followings nodes represent call sites where fuzz blockers occur.

Amount of callsites blocked Calltree index Parent function Callsite Largest blocked function
94 404 file_trycdf call site file_tryelf
87 52 file_buffer call site file_buffer
66 499 file_printable call site doshn
41 584 mcopy call site file_mdump
26 630 file_fmtdatetime call site file_fmtdatetime
20 371 cdf_ctime call site cdf_file_catalog_info
16 740 magiccheck call site file_magerror
12 236 cdf_read_dir call site cdf_swap_dir
8 962 file_buffer call site file_buffer
7 853 mprint call site file_fmtcheck
5 353 cdf_file_property_info call site cdf_app_to_mime
5 759 print_sep call site print_sep

Runtime coverage analysis

Covered functions
170
Functions that are reachable but not covered
109
Reachable functions
261
Percentage of reachable functions covered
58.24%
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
magic_fuzzer.cc 1
filemagic.c 1
filefuncs.c 32
filebuffer.c 3
fileencoding.c 10
filecompress.c 15
fileis_tar.c 3
fileis_json.c 11
fileis_csv.c 3
filereadcdf.c 9
filecdf.c 40
/usr/include/x86_64-linux-gnu/bits/byteswap.h 3
filecdf_time.c 5
filereadelf.c 9
filestrlcpy.c 1
filesoftmagic.c 29
fileapprentice.c 6
fileprint.c 6
fileder.c 6
filefmtcheck.c 4
fileascmagic.c 4

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
LLVMFuzzerInitialize /src/magic_fuzzer.cc 2 ['int *', 'char ***'] 11 0 91 12 12 147 0 1000 735
file_fsmagic /src/file/src/fsmagic.c 3 ['struct.magic_set *', 'char *', 'struct.stat *'] 16 0 880 162 63 275 4 2260 197
do_os_note /src/file/src/readelf.c 9 ['struct.magic_set *', 'char *', 'int ', 'int ', 'int ', 'int ', 'size_t ', 'size_t ', 'int *'] 6 0 532 95 39 18 0 134 75
do_core_note /src/file/src/readelf.c 11 ['struct.magic_set *', 'char *', 'int ', 'int ', 'int ', 'int ', 'size_t ', 'size_t ', 'int *', 'size_t ', 'int '] 6 0 921 149 52 19 0 124 52
do_auxv_note /src/file/src/readelf.c 15 ['struct.magic_set *', 'char *', 'int ', 'int ', 'int ', 'int ', 'size_t ', 'size_t ', 'int *', 'size_t ', 'int ', 'int ', 'size_t ', 'int ', 'size_t '] 7 0 350 48 13 18 0 102 43

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

Functions statically reachable by fuzzers
91.21%
363/398
Cyclomatic complexity statically reachable by fuzzers
95.5%
3101 / 3247

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/file/src/fsmagic.c [] []
/src/file/src/cdf.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/compress.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/ascmagic.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/print.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/funcs.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/cdf_time.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/fmtcheck.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/softmagic.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/is_tar.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/magic.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/readelf.c ['magic_fuzzer'] []
/src/magic_fuzzer.cc ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/strlcpy.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/der.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/is_json.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/readcdf.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/apprentice.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/buffer.c ['magic_fuzzer'] ['magic_fuzzer']
/src/file/src/encoding.c ['magic_fuzzer'] ['magic_fuzzer']
/usr/include/x86_64-linux-gnu/bits/byteswap.h ['magic_fuzzer'] []
/src/file/src/is_csv.c ['magic_fuzzer'] ['magic_fuzzer']

Directories in report

Directory
/src/file/src/
/src/
/usr/include/x86_64-linux-gnu/bits/