tree: 48763041bb4f3235321d2443c84e879972c7a4c3 [path history] [tgz]
  1. invalid_root_offset.afb
  2. invalid_root_offset.bin
  3. invalid_root_table_too_short.afb
  4. invalid_root_table_too_short.bin
  5. invalid_root_table_vtable_offset.afb
  6. invalid_root_table_vtable_offset.bin
  7. invalid_string_length.afb
  8. invalid_string_length.bin
  9. invalid_string_length_cut_short.afb
  10. invalid_string_length_cut_short.bin
  11. invalid_struct_array_field_cut_short.afb
  12. invalid_struct_array_field_cut_short.bin
  13. invalid_struct_field_cut_short.afb
  14. invalid_struct_field_cut_short.bin
  15. invalid_table_field_offset.afb
  16. invalid_table_field_offset.bin
  17. invalid_table_field_size.afb
  18. invalid_table_field_size.bin
  19. invalid_union_type_value.afb
  20. invalid_union_type_value.bin
  21. invalid_vector_length_cut_short.afb
  22. invalid_vector_length_cut_short.bin
  23. invalid_vector_scalars_cut_short.afb
  24. invalid_vector_scalars_cut_short.bin
  25. invalid_vector_strings_cut_short.afb
  26. invalid_vector_strings_cut_short.bin
  27. invalid_vector_structs_cut_short.afb
  28. invalid_vector_structs_cut_short.bin
  29. invalid_vector_tables_cut_short.afb
  30. invalid_vector_tables_cut_short.bin
  31. invalid_vector_union_type_value.afb
  32. invalid_vector_union_type_value.bin
  33. invalid_vector_unions_cut_short.afb
  34. invalid_vector_unions_cut_short.bin
  35. invalid_vtable_field_offset.afb
  36. invalid_vtable_field_offset.bin
  37. invalid_vtable_ref_table_size.afb
  38. invalid_vtable_ref_table_size.bin
  39. invalid_vtable_ref_table_size_short.afb
  40. invalid_vtable_ref_table_size_short.bin
  41. invalid_vtable_size.afb
  42. invalid_vtable_size.bin
  43. invalid_vtable_size_short.afb
  44. invalid_vtable_size_short.bin
  45. README.md
tests/annotated_binary/tests/README.md

Tests for Annotated Binaries

Invalid Binary Tests

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}...

invalid_root_offset.bin

Changed first two bytes from 4400 to FFFF which produces an offset larger than the binary.

invalid_root_table_vtable_offset.bin

Changed two bytes at 0x0044 from 3A00 to FFFF which points to an offset outside the binary.

invalid_root_table_too_short.bin

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.bin

invalid_vtable_size.bin

Changed two bytes at 0x000A from 3A00 to FFFF which size is larger than the binary.

invalid_vtable_size_short.bin

Changed two bytes at 0x000A from 3A00 to 0100 which size is smaller than the minimum size of 4 bytes.

invalid_vtable_ref_table_size.bin

Changed two bytes at 0x000C from 6800 to FFFF which size is larger than the binary.

invalid_vtable_ref_table_size_short.bin

Changed two bytes at 0x000C from 6800 to 0100 which size is smaller than the minimum size of 4 bytes.

invalid_vtable_field_offset.bin

Changed two bytes at 0x0016 from 1000 to FFFF which points to a field larger than the binary.

invalid_table_field_size.bin

Truncated the file to 0x52 bytes, as that cuts a Uint32t value in half.

invalid_table_field_offset.bin

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.

invalid_string_length_cut_short.bin

Truncated the file to 0xAD bytes, as that cuts string length Uint32t value in half.

invalid_string_length.bin

Changed two bytes at 0x00AC from 0500 to FFFF which is a string length larger than the binary.

invalid_vector_length_cut_short.bin

Truncated the file to 0x0136 bytes, as that cuts vector length Uint32t value in half.

invalid_struct_field_cut_short.bin

Truncated the file to 0x5d bytes, as that cuts struct field value in half.

invalid_struct_array_field_cut_short.bin

Truncated the file to 0x6A bytes, as that cuts struct array field value in half.

invalid_vector_structs_cut_short.bin

Truncated the file to 0x0154 bytes, as that cuts into a vector of structs.

invalid_vector_tables_cut_short.bin

Truncated the file to 0x01DE bytes, as that cuts into a vector of table offsets.

invalid_vector_strings_cut_short.bin

Truncated the file to 0x0176 bytes, as that cuts into a vector of string offsets.

invalid_vector_scalars_cut_short.bin

Truncated the file to 0x01C1 bytes, as that cuts into a vector of scalars values.

invalid_vector_unions_cut_short.bin

Truncated the file to 0x01DE bytes, as that cuts into a vector of union offset values.

invalid_union_type_value.bin

Changed one byte at 0x004D from 02 to FF which is a union type value that is larger than the enum.

invalid_vector_union_type_value.bin

Changed one byte at 0x0131 from 02 to FF which is a vector union type value that is larger than the enum.