• Home
Name Date Size #Lines LOC

..--

README.mdD22-Oct-20253.5 KiB12576

invalid_root_offset.afbD22-Oct-20255.6 KiB9491

invalid_root_offset.binD22-Oct-2025672

invalid_root_table_too_short.afbD22-Oct-20251.1 KiB2218

invalid_root_table_too_short.binD22-Oct-202570

invalid_root_table_vtable_offset.afbD22-Oct-20255.9 KiB9994

invalid_root_table_vtable_offset.binD22-Oct-2025672

invalid_string_length.afbD22-Oct-202523.4 KiB296251

invalid_string_length.binD22-Oct-2025672

invalid_string_length_cut_short.afbD22-Oct-20258.6 KiB8175

invalid_string_length_cut_short.binD22-Oct-2025174

invalid_struct_array_field_cut_short.afbD22-Oct-20257.9 KiB7368

invalid_struct_array_field_cut_short.binD22-Oct-2025106

invalid_struct_field_cut_short.afbD22-Oct-20257.5 KiB7065

invalid_struct_field_cut_short.binD22-Oct-202594

invalid_table_field_offset.afbD22-Oct-20258.5 KiB7873

invalid_table_field_offset.binD22-Oct-2025150

invalid_table_field_size.afbD22-Oct-20257.2 KiB6964

invalid_table_field_size.binD22-Oct-202582

invalid_union_type_value.afbD22-Oct-202523.5 KiB294250

invalid_union_type_value.binD22-Oct-2025672

invalid_vector_length_cut_short.afbD22-Oct-202512.5 KiB141122

invalid_vector_length_cut_short.binD22-Oct-2025310

invalid_vector_scalars_cut_short.afbD22-Oct-202515.9 KiB191162

invalid_vector_scalars_cut_short.binD22-Oct-2025449

invalid_vector_strings_cut_short.afbD22-Oct-202513.8 KiB156134

invalid_vector_strings_cut_short.binD22-Oct-2025374

invalid_vector_structs_cut_short.afbD22-Oct-202512.9 KiB147127

invalid_vector_structs_cut_short.binD22-Oct-2025340

invalid_vector_tables_cut_short.afbD22-Oct-202517.2 KiB211178

invalid_vector_tables_cut_short.binD22-Oct-2025478

invalid_vector_union_type_value.afbD22-Oct-202523.4 KiB294250

invalid_vector_union_type_value.binD22-Oct-2025672

invalid_vector_unions_cut_short.afbD22-Oct-202517.2 KiB211178

invalid_vector_unions_cut_short.binD22-Oct-2025478

invalid_vtable_field_offset.afbD22-Oct-202522.9 KiB287244

invalid_vtable_field_offset.binD22-Oct-2025672

invalid_vtable_ref_table_size.afbD22-Oct-202527.6 KiB361316

invalid_vtable_ref_table_size.binD22-Oct-2025672

invalid_vtable_ref_table_size_short.afbD22-Oct-202523.4 KiB298253

invalid_vtable_ref_table_size_short.binD22-Oct-2025672

invalid_vtable_size.afbD22-Oct-20255.8 KiB10095

invalid_vtable_size.binD22-Oct-2025672

invalid_vtable_size_short.afbD22-Oct-20255.8 KiB10095

invalid_vtable_size_short.binD22-Oct-2025672

README.md

1# Tests for Annotated Binaries
2
3## Invalid Binary Tests
4
5The following is a collection of manually corrupted binaries based off of
6`..\annotated_binary.bin`. Each file changes some offset or length/size entry to
7point so an invalid spot, and the generated annotated binaries demonstrate that
8those corruptions can be spotted.
9
10Each of these files were ran with the following command:
11
12```sh
13cd .tests/annotated_binary
14../../flatc -annotate annotated_binary.fbs tests/{binary_file}...
15```
16
17### `invalid_root_offset.bin`
18
19Changed first two bytes from `4400` to `FFFF` which produces an offset larger
20than the binary.
21
22### `invalid_root_table_vtable_offset.bin`
23
24Changed two bytes at 0x0044 from `3A00` to `FFFF` which points to an offset
25outside the binary.
26
27### `invalid_root_table_too_short.bin`
28
29Truncated the file to 0x46 bytes, as that cuts into the vtable offset field of
30the root table.
31
32```sh
33truncate annotated_binary.bin --size=70 >> invalid_root_table_too_short.bin
34```
35
36### `invalid_vtable_size.bin`
37
38Changed two bytes at 0x000A from `3A00` to `FFFF` which size is larger than the
39binary.
40
41### `invalid_vtable_size_short.bin`
42
43Changed two bytes at 0x000A from `3A00` to `0100` which size is smaller than the
44minimum size of 4 bytes.
45
46### `invalid_vtable_ref_table_size.bin`
47
48Changed two bytes at 0x000C from `6800` to `FFFF` which size is larger than the
49binary.
50
51### `invalid_vtable_ref_table_size_short.bin`
52
53Changed two bytes at 0x000C from `6800` to `0100` which size is smaller than
54the minimum size of 4 bytes.
55
56### `invalid_vtable_field_offset.bin`
57
58Changed two bytes at 0x0016 from `1000` to `FFFF` which points to a field larger
59than the binary.
60
61### `invalid_table_field_size.bin`
62
63Truncated the file to 0x52 bytes, as that cuts a Uint32t value in half.
64
65### `invalid_table_field_offset.bin`
66
67Truncated the file to 0x96 bytes, as that cuts a UOffset32 value in half. Also,
68changed two bytes at 0x90 from `DC00` to `FFFF` which points to a section larger
69than the binary.
70
71### `invalid_string_length_cut_short.bin`
72
73Truncated the file to 0xAD bytes, as that cuts string length Uint32t value in
74half.
75
76### `invalid_string_length.bin`
77
78Changed two bytes at 0x00AC from `0500` to `FFFF` which is a string length
79larger than the binary.
80
81### `invalid_vector_length_cut_short.bin`
82
83Truncated the file to 0x0136 bytes, as that cuts vector length Uint32t value in
84half.
85
86### `invalid_struct_field_cut_short.bin`
87
88Truncated the file to 0x5d bytes, as that cuts struct field value in half.
89
90### `invalid_struct_array_field_cut_short.bin`
91
92Truncated the file to 0x6A bytes, as that cuts struct array field value in half.
93
94### `invalid_vector_structs_cut_short.bin`
95
96Truncated the file to 0x0154 bytes, as that cuts into a vector of structs.
97
98### `invalid_vector_tables_cut_short.bin`
99
100Truncated the file to 0x01DE bytes, as that cuts into a vector of table offsets.
101
102### `invalid_vector_strings_cut_short.bin`
103
104Truncated the file to 0x0176 bytes, as that cuts into a vector of string
105offsets.
106
107### `invalid_vector_scalars_cut_short.bin`
108
109Truncated the file to 0x01C1 bytes, as that cuts into a vector of scalars
110values.
111
112### `invalid_vector_unions_cut_short.bin`
113
114Truncated the file to 0x01DE bytes, as that cuts into a vector of union offset
115values.
116
117### `invalid_union_type_value.bin`
118
119Changed one byte at 0x004D from `02` to `FF` which is a union type value that is
120larger than the enum.
121
122### `invalid_vector_union_type_value.bin`
123
124Changed one byte at 0x0131 from `02` to `FF` which is a vector union type value
125that is larger than the enum.