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

Fuzzer details

Fuzzer: magic_fuzzer_fd

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 505 45.0%
gold [1:9] 30 2.67%
yellow [10:29] 24 2.13%
greenyellow [30:49] 7 0.62%
lawngreen 50+ 556 49.5%
All colors 1122 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
2755 2875 11 :

['handle_mime', 'readlink', 'file_error', 'stat', 'gnu_dev_minor', 'lstat', 'gnu_dev_major', 'strerror', 'magic_file', 'bad_link', '__errno_location']

2755 2875 file_fsmagic call site /src/file/src/fsmagic.c:117
703 703 2 :

['apprentice_load', 'file_magwarn']

957 965 apprentice_1 call site /src/file/src/apprentice.c:498
350 350 1 :

['cdf_check_summary_info']

350 418 file_trycdf call site /src/file/src/readcdf.c:640
176 176 1 :

['apprentice_list']

176 176 apprentice_1 call site /src/file/src/apprentice.c:518
125 125 2 :

['mdebug', 'file_mdump']

127 2252 mget call site /src/file/src/softmagic.c:1798
92 92 1 :

['file_pipe2file']

94 1498 file_tryelf call site /src/file/src/readelf.c:1854
84 84 1 :

['apprentice_compile']

779 779 apprentice_1 call site /src/file/src/apprentice.c:489
62 62 1 :

['cdf_read_sector_chain']

62 62 cdf_read_user_stream call site /src/file/src/cdf.c:868
50 72 2 :

['sread', 'unreadable_info']

52 2345 file_or_fd call site /src/file/src/magic.c:496
44 55 4 :

['regerror', 'strlen', 'file_magerror', 'file_printable']

44 55 file_regcomp call site /src/file/src/funcs.c:712
40 40 1 :

['file_oomem']

53 53 apprentice_map call site /src/file/src/apprentice.c:3274
40 40 1 :

['mlist_free_one']

40 40 mlist_free call site /src/file/src/apprentice.c:677

Runtime coverage analysis

Covered functions
200
Functions that are reachable but not covered
134
Reachable functions
302
Percentage of reachable functions covered
55.63%
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_fd.cc 1
fuzzer_temp_file.h 5
filemagic.c 5
filefuncs.c 33
filefsmagic.c 3
filecompress.c 21
filebuffer.c 3
fileencoding.c 10
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 7
fileder.c 6
filefmtcheck.c 4
fileascmagic.c 4

Fuzzer: magic_fuzzer_loaddb

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 148 31.1%
gold [1:9] 1 0.21%
yellow [10:29] 2 0.42%
greenyellow [30:49] 2 0.42%
lawngreen 50+ 322 67.7%
All colors 475 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
176 176 1 :

['apprentice_list']

176 176 apprentice_1 call site /src/file/src/apprentice.c:518
86 246 7 :

['file_error', 'fstat', 'maxoff_t', 'mmap', 'mprotect', 'check_buffer', '__errno_location']

90 261 apprentice_map call site /src/file/src/apprentice.c:3284
40 40 1 :

['file_oomem']

42 53 apprentice_map call site /src/file/src/apprentice.c:3274
40 40 1 :

['file_oomem']

40 40 parse call site /src/file/src/apprentice.c:2061
40 40 1 :

['file_oomem']

40 40 parse call site /src/file/src/apprentice.c:2076
40 40 1 :

['file_oomem']

40 40 addentry call site /src/file/src/apprentice.c:1289
40 40 1 :

['file_oomem']

40 40 coalesce_entries call site /src/file/src/apprentice.c:1475
40 40 1 :

['file_oomem']

40 40 file_check_mem call site /src/file/src/funcs.c:616
20 20 2 :

['get_default_magic', 'getenv']

20 20 magic_getpath call site /src/file/src/magic.c:256
4 4 1 :

['__errno_location']

4 44 load_1 call site /src/file/src/apprentice.c:1319
4 4 2 :

['abort', 'close']

4 4 fuzzer_get_tmpfile(unsignedcharconst*,unsignedlong) call site /src/fuzzer_temp_file.h:47
2 378 4 :

['check_format', 'getvalue', '__ctype_b_loc', 'file_mdump']

2 386 parse call site /src/file/src/apprentice.c:2344

Runtime coverage analysis

Covered functions
93
Functions that are reachable but not covered
69
Reachable functions
153
Percentage of reachable functions covered
54.9%
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_loaddb.cc 1
fuzzer_temp_file.h 5
filemagic.c 7
fileapprentice.c 53
filefuncs.c 17
fileprint.c 7
filecdf_time.c 4
filestrlcpy.c 1
fileencoding.c 1
/usr/include/x86_64-linux-gnu/bits/byteswap.h 3

Fuzzer: magic_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 437 42.0%
gold [1:9] 24 2.30%
yellow [10:29] 21 2.02%
greenyellow [30:49] 11 1.05%
lawngreen 50+ 546 52.5%
All colors 1039 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
703 703 2 :

['apprentice_load', 'file_magwarn']

957 965 apprentice_1 call site /src/file/src/apprentice.c:498
176 176 1 :

['apprentice_list']

176 176 apprentice_1 call site /src/file/src/apprentice.c:518
176 176 3 :

['cdf_tole2', 'cdf_app_to_mime', 'cdf_file_catalog_info']

176 176 cdf_check_summary_info call site /src/file/src/readcdf.c:405
125 125 2 :

['mdebug', 'file_mdump']

127 2252 mget call site /src/file/src/softmagic.c:1798
84 84 1 :

['apprentice_compile']

779 779 apprentice_1 call site /src/file/src/apprentice.c:489
44 55 4 :

['regerror', 'strlen', 'file_magerror', 'file_printable']

44 55 file_regcomp call site /src/file/src/funcs.c:712
40 47 2 :

['file_magerror', 'buffer_init']

40 47 msetoffset call site /src/file/src/softmagic.c:1518
40 40 1 :

['file_oomem']

53 53 apprentice_map call site /src/file/src/apprentice.c:3274
40 40 1 :

['mlist_free_one']

40 40 mlist_free call site /src/file/src/apprentice.c:677
40 40 1 :

['file_oomem']

40 40 file_ascmagic_with_encoding call site /src/file/src/ascmagic.c:146
40 40 1 :

['file_oomem']

40 40 file_encoding call site /src/file/src/encoding.c:153
40 40 1 :

['file_oomem']

40 40 file_getbuffer call site /src/file/src/funcs.c:550

Runtime coverage analysis

Covered functions
192
Functions that are reachable but not covered
107
Reachable functions
277
Percentage of reachable functions covered
61.37%
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 33
filebuffer.c 3
fileencoding.c 10
filecompress.c 21
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 7
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
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 13 0 118 76
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 14 0 108 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 13 0 85 43

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

Functions statically reachable by fuzzers
89.81%
388/432
Cyclomatic complexity statically reachable by fuzzers
94.32%
3140 / 3329

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

Directories in report

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