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: fuzz_parser

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 9229 90.1%
gold [1:9] 111 1.08%
yellow [10:29] 70 0.68%
greenyellow [30:49] 6 0.05%
lawngreen 50+ 820 8.01%
All colors 10236 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
902 2566 6 :

['errfinish', 'errmsg', 'MemoryContextStats', 'errcode', 'errdetail', 'errstart_cold']

902 2566 AllocSetContextCreateInternal call site: 00007 /src/libpg_query/src/postgres/src_backend_utils_mmgr_aset.c:468
671 671 7 :

['ProcessInterrupts', 'FreeErrorDataContents', 'EmitErrorReport', 'fflush', 'abort', 'proc_exit', 'MemoryContextSwitchTo.221']

671 671 errfinish call site: 00118 /src/libpg_query/src/postgres/src_backend_utils_error_elog.c:547
488 488 1 :

['MemoryContextAllocationFailure']

488 488 AllocSetRealloc call site: 00000 /src/libpg_query/src/postgres/src_backend_utils_mmgr_aset.c:1418
488 488 1 :

['MemoryContextAllocationFailure']

488 488 AllocSetAllocLarge call site: 00000 /src/libpg_query/src/postgres/src_backend_utils_mmgr_aset.c:739
434 2098 8 :

['Int32GetDatum', 'errfinish', 'errmsg', 'CStringGetDatum', 'errcode', 'GetDatabaseEncodingName', 'FunctionCall6Coll', 'errstart_cold']

434 2107 pg_unicode_to_server call site: 00416 /src/libpg_query/src/postgres/src_backend_utils_mb_mbutils.c:321
416 1248 3 :

['errstart_cold', 'errmsg_internal', 'errfinish']

416 1248 hexval call site: 00590 /src/libpg_query/src/postgres/src_backend_parser_parser.c:349
229 229 2 :

['write_stderr', 'exit']

229 229 errstart call site: 00094 /src/libpg_query/src/postgres/src_backend_utils_error_elog.c:440
16 1687 3 :

['check_uescapechar', 'core_yylex', 'scanner_yyerror']

20 2641 base_yylex call site: 00576 /src/libpg_query/src/postgres/src_backend_parser_parser.c:271
7 7 1 :

['flushbuffer']

7 7 dostr call site: 00027 /src/libpg_query/src/postgres/src_port_snprintf.c:1330
7 7 1 :

['flushbuffer']

7 7 dopr_outch call site: 00027 /src/libpg_query/src/postgres/src_port_snprintf.c:1352
5 5 1 :

['cliplen']

5 5 pg_encoding_mbcliplen call site: 00017 /src/libpg_query/src/postgres/src_backend_utils_mb_mbutils.c:439
0 418 2 :

['get_error_stack_entry', 'set_stack_entry_domain']

0 418 errsave_start call site: 00519 /src/libpg_query/src/postgres/src_backend_utils_error_elog.c:678

Runtime coverage analysis

Covered functions
300
Functions that are reachable but not covered
979
Reachable functions
1247
Percentage of reachable functions covered
21.49%
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
./test/fuzz/fuzz_parser.c 1
src/pg_query_parse.c 4
src/pg_query.c 6
src/postgres/src_backend_utils_mmgr_mcxt.c 24
src/postgres/src_backend_utils_mmgr_aset.c 2
src/postgres/src_backend_utils_mb_mbutils.c 14
src/postgres/src_common_wchar.c 3
src/postgres/src_port_snprintf.c 23
src/postgres/src_port_strerror.c 3
src/postgres/src_backend_utils_error_elog.c 27
./src/postgres/include/utils/palloc.h 1
src/postgres/src_common_stringinfo.c 8
src/postgres/src_common_psprintf.c 2
src/postgres/src_backend_storage_ipc_ipc.c 1
src/postgres/src_backend_tcop_postgres.c 3
src/postgres/src_backend_utils_error_assert.c 1
src/postgres/src_backend_parser_parser.c 6
scan.l 17
scan.c 16
gram.y 43
gram.c 1
./src/postgres/include/port/pg_bitutils.h 3
src/postgres/src_common_kwlookup.c 1
./src/postgres/include/common/kwlookup.h 1
./src/postgres/include/mb/pg_wchar.h 5
./src/postgres/include/postgres.h 4
src/postgres/src_backend_utils_fmgr_fmgr.c 1
src/postgres/src_backend_parser_scansup.c 4
/usr/include/stdlib.h 1
src/postgres/src_backend_utils_adt_numutils.c 1
src/postgres/src_backend_nodes_list.c 18
./src/postgres/include/nodes/nodes.h 1
./src/postgres/include/nodes/pg_list.h 5
src/postgres/src_backend_nodes_value.c 4
src/postgres/src_backend_nodes_makefuncs.c 19
src/postgres/src_backend_commands_define.c 1
src/postgres/src_backend_catalog_namespace.c 1
src/postgres/src_port_pgstrcasecmp.c 1
src/postgres/src_backend_nodes_copyfuncs.c 5
./src/postgres/include/copyfuncs.funcs.c 320
src/postgres/src_backend_nodes_bitmapset.c 3
src/postgres/src_backend_utils_adt_datum.c 3
src/postgres/src_backend_utils_adt_expandeddatum.c 3
src/postgres/src_backend_nodes_extensible.c 1
src/postgres/src_backend_nodes_equalfuncs.c 6
./src/postgres/include/equalfuncs.funcs.c 266
src/postgres/src_backend_nodes_nodeFuncs.c 2
src/pg_query_outfuncs_json.c 11
./src/include/pg_query_outfuncs_defs.c 256
./src/include/pg_query_json_helper.c 2
./src/include/pg_query_enum_defs.c 63

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
pg_query__scan_token__unpack /src/libpg_query/protobuf/pg_query.pb-c.c 3 ['N/A', 'size_t', 'N/A'] 5 0 15 3 2 28 0 273 273
pg_query_parse_protobuf /src/libpg_query/src/pg_query_parse.c 2 ['N/A', 'N/A'] 18 0 13 3 2 1286 0 8677 231
raw_expression_tree_walker_impl /src/libpg_query/src/postgres/src_backend_nodes_nodeFuncs.c 3 ['N/A', 'N/A', 'N/A'] 16 0 2126 411 159 85 0 585 159
protobuf_c_message_check /src/libpg_query/vendor/protobuf-c/protobuf-c.c 1 ['N/A'] 2 0 384 86 38 1 1 76 76
GenerationRealloc /src/libpg_query/src/postgres/src_backend_utils_mmgr_generation.c 3 ['N/A', 'size_t', 'int'] 18 0 97 18 7 117 0 556 70
protobuf_c_message_pack_to_buffer /src/libpg_query/vendor/protobuf-c/protobuf-c.c 2 ['N/A', 'N/A'] 11 0 174 29 11 37 278 205 70
pg_utf8_verifystr /src/libpg_query/src/postgres/src_common_wchar.c 2 ['N/A', 'int'] 2 0 168 35 14 10 0 60 55

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

Functions statically reachable by fuzzers
42.0%
1333 / 3203
Cyclomatic complexity statically reachable by fuzzers
67.0%
9283 / 13791

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

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/libpg_query/src/postgres/src_backend_utils_mmgr_mcxt.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_utils_mmgr_bump.c [] []
/src/libpg_query/gram.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/./src/postgres/include/copyfuncs.funcs.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_utils_adt_datum.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_nodes_value.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/./src/postgres/include/utils/memutils_memorychunk.h [] []
/src/libpg_query/src/postgres/src_common_kwlookup.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_utils_adt_numutils.c ['fuzz_parser'] ['fuzz_parser']
/usr/include/stdlib.h ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_nodes_list.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_port_strerror.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_port_pgstrcasecmp.c ['fuzz_parser'] []
/src/libpg_query/protobuf/pg_query.pb-c.c [] []
/src/libpg_query/./src/postgres/include/utils/memutils_internal.h [] []
/src/libpg_query/src/postgres/src_backend_utils_fmgr_fmgr.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_parser_parser.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/pg_query_outfuncs_protobuf.c [] []
/src/libpg_query/./src/postgres/include/postgres.h ['fuzz_parser'] []
/src/libpg_query/./src/postgres/include/lib/ilist.h [] []
/src/libpg_query/./src/postgres/include/port/pg_bitutils.h ['fuzz_parser'] []
/src/libpg_query/./src/postgres/include/kwlist_d.h [] []
/src/libpg_query/./src/postgres/include/nodes/nodes.h ['fuzz_parser'] []
/src/libpg_query/./src/include/pg_query_json_helper.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_utils_mmgr_slab.c [] []
/src/libpg_query/src/postgres/src_backend_catalog_namespace.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_nodes_extensible.c ['fuzz_parser'] []
/src/libpg_query/./src/postgres/include/utils/palloc.h ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_nodes_equalfuncs.c ['fuzz_parser'] []
/src/libpg_query/./src/postgres/include/port/simd.h [] []
/src/libpg_query/src/postgres/src_backend_parser_scansup.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_utils_mmgr_aset.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/./src/include/pg_query_outfuncs_defs.c ['fuzz_parser'] []
/src/libpg_query/vendor/protobuf-c/protobuf-c.c [] []
/src/libpg_query/src/postgres/src_backend_utils_mb_mbutils.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_nodes_makefuncs.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_utils_error_elog.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/./src/include/pg_query_enum_defs.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_port_snprintf.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_tcop_postgres.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_nodes_nodeFuncs.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/./src/postgres/include/mb/pg_wchar.h ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_nodes_copyfuncs.c ['fuzz_parser'] []
/src/libpg_query/./test/fuzz/fuzz_parser.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_common_psprintf.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/gram.y ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_utils_mmgr_generation.c [] []
/src/libpg_query/src/pg_query_outfuncs_json.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/./src/postgres/include/common/kwlookup.h ['fuzz_parser'] []
/src/libpg_query/src/pg_query.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_commands_define.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_storage_ipc_ipc.c ['fuzz_parser'] []
/src/libpg_query/./src/postgres/include/equalfuncs.funcs.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_backend_utils_adt_expandeddatum.c ['fuzz_parser'] []
/src/libpg_query/scan.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_utils_error_assert.c ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_common_stringinfo.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/pg_query_parse.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/src/postgres/src_backend_utils_mmgr_alignedalloc.c [] []
/src/libpg_query/src/postgres/src_port_pg_bitutils.c [] []
/src/libpg_query/src/postgres/src_backend_nodes_bitmapset.c ['fuzz_parser'] []
/src/libpg_query/./src/postgres/include/nodes/pg_list.h ['fuzz_parser'] []
/src/libpg_query/src/postgres/src_common_wchar.c ['fuzz_parser'] ['fuzz_parser']
/src/libpg_query/./src/postgres/include/utils/ascii.h [] []
/src/libpg_query/scan.l ['fuzz_parser'] ['fuzz_parser']

Directories in report

Directory
/src/libpg_query/protobuf/
/src/libpg_query/./src/include/
/src/libpg_query/vendor/protobuf-c/
/src/libpg_query/./src/postgres/include/common/
/src/libpg_query/./test/fuzz/
/src/libpg_query/src/postgres/
/src/libpg_query/
/src/libpg_query/./src/postgres/include/nodes/
/src/libpg_query/./src/postgres/include/lib/
/src/libpg_query/./src/postgres/include/
/src/libpg_query/./src/postgres/include/port/
/src/libpg_query/./src/postgres/include/mb/
/src/libpg_query/src/
/usr/include/
/src/libpg_query/./src/postgres/include/utils/