The following is a collection of manually corrupted binaries based off of
..\annotated_binary.bin. Each file changes some offset or length/size entry to
point so an invalid spot, and the generated annotated binaries demonstrate that
those corruptions can be spotted.
Each of these files were ran with the following command:
cd .tests/annotated_binary
../../flatc -annotate annotated_binary.fbs tests/{binary_file}...Changed first two bytes from 4400 to FFFF which produces an offset larger
than the binary.
Changed two bytes at 0x0044 from 3A00 to FFFF which points to an offset
outside the binary.
Truncated the file to 0x46 bytes, as that cuts into the vtable offset field of the root table.
truncate annotated_binary.bin --size=70 >> invalid_root_table_too_short.binChanged two bytes at 0x000A from 3A00 to FFFF which size is larger than the
binary.
Changed two bytes at 0x000A from 3A00 to 0100 which size is smaller than the
minimum size of 4 bytes.
Changed two bytes at 0x000C from 6800 to FFFF which size is larger than the
binary.
Changed two bytes at 0x000C from 6800 to 0100 which size is smaller than
the minimum size of 4 bytes.
Changed two bytes at 0x0016 from 1000 to FFFF which points to a field larger
than the binary.
Truncated the file to 0x52 bytes, as that cuts a Uint32t value in half.
Truncated the file to 0x96 bytes, as that cuts a UOffset32 value in half. Also,
changed two bytes at 0x90 from DC00 to FFFF which points to a section larger
than the binary.
Truncated the file to 0xAD bytes, as that cuts string length Uint32t value in half.
Changed two bytes at 0x00AC from 0500 to FFFF which is a string length
larger than the binary.
Truncated the file to 0x0136 bytes, as that cuts vector length Uint32t value in half.
Truncated the file to 0x5d bytes, as that cuts struct field value in half.
Truncated the file to 0x6A bytes, as that cuts struct array field value in half.
Truncated the file to 0x0154 bytes, as that cuts into a vector of structs.
Truncated the file to 0x01DE bytes, as that cuts into a vector of table offsets.
Truncated the file to 0x0176 bytes, as that cuts into a vector of string offsets.
Truncated the file to 0x01C1 bytes, as that cuts into a vector of scalars values.
Truncated the file to 0x01DE bytes, as that cuts into a vector of union offset values.
Changed one byte at 0x004D from 02 to FF which is a union type value that is
larger than the enum.
Changed one byte at 0x0131 from 02 to FF which is a vector union type value
that is larger than the enum.