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

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 4603 81.7%
gold [1:9] 231 4.10%
yellow [10:29] 82 1.45%
greenyellow [30:49] 17 0.30%
lawngreen 50+ 700 12.4%
All colors 5633 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
807 4822 dwg_model_space_object call site: 04822 dwg_write_dxfb
455 4365 is_type_unstable call site: 04365 dwg_write_dxf
322 2470 dwg_add_handle call site: 02470 _set_struct_field
286 876 bit_read_fixed call site: 00876 read_2004_section_classes
200 1421 bit_chain_free call site: 01421 read_2007_section_classes
151 4102 bit_write_RLL_BE call site: 04102 encode_classes
147 587 resolve_objectref_vector call site: 00587 decode_R2004
132 1622 bit_convert_TU call site: 01622 read_2007_section_handles
120 751 bit_write_RC call site: 00751 read_R2004_section_info
119 3597 dwg_free_eed call site: 03597 add_DUMMY_eed
116 2181 json_longlong call site: 02181 json_CMC
105 1283 read_file_header call site: 01283 decompress_r2007

Runtime coverage analysis

Covered functions
565
Functions that are reachable but not covered
901
Reachable functions
1158
Percentage of reachable functions covered
22.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.
Function name source code lines source lines hit percentage hit

Files reached

filename functions hit
examples/llvmfuzz.c 23
src/decode.c 138
src/hash.c 10
src/decode_r11.c 13
src/dwg_api.c 44
src/dwg.c 57
src/bits.c 58
src/codepages.c 5
src/common.c 12
src/print.c 91
src/decode_r2007.c 93
src/free.c 197
src/classes.c 10
src/in_json.c 126
src/dynapi.c 30
src/objects.c 3
src/in_dxf.c 78
src/encode.c 150
test/unit-testing/pointcloud.c 6
test/unit-testing/tests_common.h 4
src/out_dxf.c 145
src/out_dxfb.c 133
src/out_json.c 147

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
test_dynapi /src/libredwg/test/unit-testing/dynapi_test.c 1 ['char*'] 10 0 14 2 3 798 0 19075 17633
new_object /src/libredwg/src/in_dxf.c 6 ['char*', 'char*', 'Bit_Chain*', 'Dwg_Data*', 'BITCODE_BL', 'BITCODE_BL*'] 8 0 624 148 253 143 0 1021 560
json_xdata /src/libredwg/src/out_json.c 2 ['Bit_Chain*', 'Dwg_Object_XRECORD*'] 5 0 547 167 163 156 0 399 259
add_MULTILEADER /src/libredwg/src/in_dxf.c 3 ['Dwg_Object*', 'Bit_Chain*', 'Dxf_Pair*'] 4 0 448 129 176 20 0 280 241
add_HATCH /src/libredwg/src/in_dxf.c 3 ['Dwg_Object*', 'Bit_Chain*', 'Dxf_Pair*'] 8 0 530 115 173 70 0 571 229
dwg_add_dat /src/libredwg/examples/dwgadd.c 2 ['Dwg_Data**', 'Bit_Chain*'] 11 0 499 93 144 674 0 2789 220
decode_preR13_entities /src/libredwg/src/decode.c 7 ['BITCODE_RL', 'BITCODE_RL', 'unsigned', 'BITCODE_RL', 'Bit_Chain*', 'Dwg_Data*', 'EntitySectionIndexR11'] 7 0 362 91 113 90 0 304 181

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

Functions statically reachable by fuzzers
33.0%
950 / 2904
Cyclomatic complexity statically reachable by fuzzers
80.0%
23423 / 29460

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

Runtime coverage analysis

This section shows analysis of runtime coverage data.

For futher technical details on how this section is generated, please see the Glossary .

Complex functions with low coverage

Func name Function total lines Lines covered at runtime percentage covered Reached by fuzzers
LLVMFuzzerTestOneInput 131 71 54.19%
jsmn_parse_string 54 18 33.33%
bit_write_H 36 14 38.88% ['llvmfuzz']
bit_write_TV 38 17 44.73% ['llvmfuzz']
bit_read_CMC 38 8 21.05% ['llvmfuzz']
dwg_decode_handleref 81 37 45.67% ['llvmfuzz']
dwg_fixup_BLOCKS_entities 170 34 20.0% ['llvmfuzz']
dwg_decode_xdata 207 47 22.70% ['llvmfuzz']
read_r2007_meta_data 76 9 11.84% ['llvmfuzz']
dwg_model_space_ref 35 13 37.14%
dwg_model_space_object 35 7 20.0% ['llvmfuzz']
dwg_resbuf_value_type 126 60 47.61% ['llvmfuzz']
dwg_ctrl_table 137 39 28.46% ['llvmfuzz']
dwg_decode_LAYER_private 135 67 49.62%
dwg_decode_LTYPE_private 117 64 54.70%
dwg_decode_VIEW_private 97 49 50.51%
dwg_decode_VPORT_private 172 63 36.62%
dwg_decode_DIMENSION_LINEAR_private 40 15 37.5%
dwg_decode_DIMENSION_ALIGNED_private 34 13 38.23%
dwg_decode_DIMENSION_ANG3PT_private 41 13 31.70%
dwg_decode_DIMENSION_ANG2LN_private 47 17 36.17%
decode_3dsolid 125 46 36.8%
dwg_decode_MTEXT_private 91 26 28.57%
dwg_decode_HATCH_private 191 49 25.65%
dwg_decode_XRECORD_private 51 21 41.17%
dwg_decode_LAYOUT_private 121 66 54.54%
dwg_free_HATCH_private 191 75 39.26%
dwg_free_INSERT_private 162 86 53.08%
dwg_free_JUMP_private 48 3 6.25%
dwg_free_MINSERT_private 117 45 38.46%
dwg_free_MTEXT_private 91 26 28.57%
dwg_free_SPLINE_private 87 47 54.02%
dwg_free_VERTEX_2D_private 75 38 50.66%
dwg_free_LAYER_private 135 67 49.62%
dwg_free_LAYOUT_private 121 57 47.10%
dwg_free_LTYPE_private 125 55 44.0%
dwg_free_TABLESTYLE_private 67 22 32.83%
dwg_free_VIEW_private 97 44 45.36%
dwg_free_VPORT_private 172 83 48.25%
dwg_free_XRECORD_private 51 18 35.29%
dwg_encode_TEXT_private 146 27 18.49%
dwg_encode_ATTRIB_private 185 38 20.54%
dwg_encode_ATTDEF_private 194 40 20.61%
dwg_encode_INSERT_private 163 22 13.49%
dwg_encode_POLYLINE_2D_private 84 24 28.57%
dwg_encode_POLYLINE_3D_private 55 23 41.81%
dwg_encode_LINE_private 66 15 22.72%
dwg_encode_DIMENSION_ORDINATE_private 43 15 34.88%
dwg_encode_DIMENSION_LINEAR_private 41 17 41.46%
dwg_encode_DIMENSION_ALIGNED_private 35 14 40.0%
dwg_encode_DIMENSION_ANG3PT_private 42 14 33.33%
dwg_encode_DIMENSION_ANG2LN_private 48 14 29.16%
dwg_encode__3DFACE_private 92 25 27.17%
dwg_encode_POLYLINE_PFACE_private 42 19 45.23%
dwg_encode_POLYLINE_MESH_private 66 25 37.87%
dwg_encode_SHAPE_private 46 11 23.91%
dwg_encode_VIEWPORT_private 125 21 16.8%
dwg_insert_entity 113 36 31.85% ['llvmfuzz']
dwg_dynapi_common_value 45 21 46.66% ['llvmfuzz']
dwg_dynapi_common_set_value 82 31 37.80% ['llvmfuzz']
dynapi_set_helper 44 20 45.45% ['llvmfuzz']
dwg_encode 1137 136 11.96% ['llvmfuzz']
dwg_encode_get_class 59 5 8.474% ['llvmfuzz']
in_postprocess_handles 77 22 28.57%
remove_EXEMPT_FROM_CAD_STANDARDS_APPID 48 11 22.91% ['llvmfuzz']
encode_preR13_entities 237 89 37.55% ['llvmfuzz']
dwg_encode_entity 49 21 42.85% ['llvmfuzz']
fixup_invalid_tag 42 22 52.38% ['llvmfuzz']
dwg_free_variable_type 33 9 27.27% ['llvmfuzz']
dxf_read_string 83 33 39.75% ['llvmfuzz']
dxf_header_read 264 139 52.65% ['llvmfuzz']
matches_type 56 19 33.92% ['llvmfuzz']
dxf_tables_read 229 87 37.99%
new_table_control 227 80 35.24% ['llvmfuzz']
new_object 3195 632 19.78% ['llvmfuzz']
add_MLINE 221 50 22.62% ['llvmfuzz']
get_numfield_value 31 11 35.48% ['llvmfuzz']
add_TABLESTYLE 153 36 23.52% ['llvmfuzz']
resolve_postponed_header_refs 47 6 12.76%
dxf_blocks_read 188 78 41.48%
resolve_postponed_object_refs 99 19 19.19%
add_to_BLOCK_HEADER 31 6 19.35%
json_OBJECTS 578 131 22.66% ['llvmfuzz']

Fuzz driver synthesis

New fuzzers

The below fuzzers are templates and suggestions for how to target the set of optimal functions above

dynapi_test.c

Target file: /src/libredwg/test/unit-testing/dynapi_test.c
Target functions: test_dynapi
#include "ada_fuzz_header.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  af_safe_gb_init(data, size);

  /* target test_dynapi */
  char *new_var0 = ada_safe_get_char_p();
  test_dynapi(new_var0);

  af_safe_gb_cleanup();
}

in_dxf.c

Target file: /src/libredwg/src/in_dxf.c
Target functions: new_object, add_MULTILEADER, add_HATCH
#include "ada_fuzz_header.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  af_safe_gb_init(data, size);

  /* target new_object */
  char *new_var1 = ada_safe_get_char_p();
  char *new_var2 = ada_safe_get_char_p();
  UNKNOWN_TYPE unknown_3;
  UNKNOWN_TYPE unknown_4;
  UNKNOWN_TYPE unknown_5;
  UNKNOWN_TYPE unknown_6;
  new_object(new_var1, new_var2, unknown_3, unknown_4, unknown_5, unknown_6);

  /* target add_MULTILEADER */
  UNKNOWN_TYPE unknown_9;
  UNKNOWN_TYPE unknown_10;
  UNKNOWN_TYPE unknown_11;
  add_MULTILEADER(unknown_9, unknown_10, unknown_11);

  /* target add_HATCH */
  UNKNOWN_TYPE unknown_12;
  UNKNOWN_TYPE unknown_13;
  UNKNOWN_TYPE unknown_14;
  add_HATCH(unknown_12, unknown_13, unknown_14);

  af_safe_gb_cleanup();
}

out_json.c

Target file: /src/libredwg/src/out_json.c
Target functions: json_xdata
#include "ada_fuzz_header.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  af_safe_gb_init(data, size);

  /* target json_xdata */
  UNKNOWN_TYPE unknown_7;
  UNKNOWN_TYPE unknown_8;
  json_xdata(unknown_7, unknown_8);

  af_safe_gb_cleanup();
}

dwgadd.c

Target file: /src/libredwg/examples/dwgadd.c
Target functions: dwg_add_dat
#include "ada_fuzz_header.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  af_safe_gb_init(data, size);

  /* target dwg_add_dat */
  UNKNOWN_TYPE unknown_15;
  UNKNOWN_TYPE unknown_16;
  dwg_add_dat(unknown_15, unknown_16);

  af_safe_gb_cleanup();
}

decode.c

Target file: /src/libredwg/src/decode.c
Target functions: decode_preR13_entities
#include "ada_fuzz_header.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
  af_safe_gb_init(data, size);

  /* target decode_preR13_entities */
  UNKNOWN_TYPE unknown_17;
  UNKNOWN_TYPE unknown_18;
  UNKNOWN_TYPE unknown_19;
  UNKNOWN_TYPE unknown_20;
  UNKNOWN_TYPE unknown_21;
  UNKNOWN_TYPE unknown_22;
  UNKNOWN_TYPE unknown_23;
  decode_preR13_entities(unknown_17, unknown_18, unknown_19, unknown_20, unknown_21, unknown_22, unknown_23);

  af_safe_gb_cleanup();
}

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/libredwg/test/unit-testing/common.c [] []
/src/libredwg/src/logging.h [] []
/src/libredwg/programs/my_stat.h [] []
/src/libredwg/src/spec.h [] []
/src/libredwg/src/out_geojson.c [] []
/src/libredwg/test/xmlsuite/common.c [] []
/src/libredwg/test/unit-testing/dxf_test.c [] []
/src/libredwg/test/unit-testing/add_test.c [] []
/src/libredwg/examples/dwg2svg2.c [] []
/src/libredwg/test/unit-testing/tests_common.h ['llvmfuzz'] []
/src/libredwg/src/classes.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/myalloca.h [] []
/src/libredwg/src/dwg_api.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/in_dxf.h [] []
/src/libredwg/src/encode.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/objects.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/test/unit-testing/imagedef_reactor.c [] []
/src/libredwg/src/dynapi.h [] []
/src/libredwg/examples/bits.c [] []
/src/libredwg/test/unit-testing/common_test.c [] []
/src/libredwg/examples/dwgfuzz.c [] []
/src/libredwg/test/unit-testing/dynapi_test.c [] []
/src/libredwg/src/decode_r2007.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/include/dwg.h [] []
/src/libredwg/src/dynapi.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/test/unit-testing/decode_test.c [] []
/src/libredwg/src/decode_r11.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/codepages.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/test/xmlsuite/testsuite.c [] []
/src/libredwg/src/in_dxf.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/programs/dxf2dwg.c [] []
/src/libredwg/examples/llvmfuzz.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/geom.c [] []
/src/libredwg/examples/load_dwg.c [] []
/src/libredwg/src/dec_macros.h [] []
/src/libredwg/src/reedsolomon.c [] []
/src/libredwg/src/free.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/programs/dwgbmp.c [] []
/src/libredwg/src/print.c ['llvmfuzz'] []
/src/libredwg/src/in_json.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/test/unit-testing/material.c [] []
/src/libredwg/src/bits.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/out_dxfb.c ['llvmfuzz'] []
/src/libredwg/src/dxfclasses.c [] []
/src/libredwg/programs/dwg2SVG.c [] []
/src/libredwg/programs/getopt.c [] []
/src/libredwg/programs/escape.c [] []
/src/libredwg/examples/dwgadd.c [] []
/src/libredwg/include/dwg_api.h [] []
/src/libredwg/src/out_dxf.c ['llvmfuzz'] []
/src/libredwg/src/decode.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/common.h [] []
/src/libredwg/src/dwg.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/examples/unknown.c [] []
/src/libredwg/src/hash.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/test/unit-testing/bits_test.c [] []
/src/libredwg/src/common.c ['llvmfuzz'] ['llvmfuzz']
/src/libredwg/src/out_json.c ['llvmfuzz'] []
/src/libredwg/programs/dwg2ps.c [] []
/src/libredwg/programs/dwggrep.c [] []
/src/libredwg/test/unit-testing/encode_test.c [] []
/src/libredwg/src/bits.h [] []

Directories in report

Directory
/src/libredwg/test/xmlsuite/
/src/libredwg/programs/
/src/libredwg/examples/
/src/libredwg/test/unit-testing/
/src/libredwg/include/
/src/libredwg/src/