message: tests: add test case for invalid
  In imports, exports and custom sections.
diff: @@ -189,6 +189,12 @@ TEST(parser, custom_section_out_of_bounds)
  EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "Unexpected EOF");
  }
  +TEST(parser, custom_section_invalid_utf8)
  +{
  + const auto bin = bytes{wasm_prefix} + make_section(0, "027f80"_bytes);
  + EXPECT_THROW_MESSAGE(parse(bin), parser_error, "Invalid UTF-8");
  +}
  +
  TEST(parser, type_section_empty)
  {
  const auto bin = bytes{wasm_prefix} + make_section(1, make_vec({}));
  @@ -364,6 +370,22 @@ TEST(parser, import_kind_out_of_bounds)
  EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "Unexpected EOF");
  }
  +TEST(parser, import_invalid_utf8_in_module)
  +{
  + const auto section_contents =
  + bytes{0x01, 0x03, 'm', 0x80, 'd', 0x03, 'f', 'o', 'o', 0x00, 0x42};
  + const auto wasm = bytes{wasm_prefix} + make_section(2, section_contents);
  + EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "Invalid UTF-8");
  +}
  +
  +TEST(parser, import_invalid_utf8_in_name)
  +{
  + const auto section_contents =
  + bytes{0x01, 0x03, 'm', 'o', 'd', 0x03, 'f', 0x80, 'o', 0x00, 0x42};
  + const auto wasm = bytes{wasm_prefix} + make_section(2, section_contents);
  + EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "Invalid UTF-8");
  +}
  +
  TEST(parser, memory_and_imported_memory)
  {
  // (import "js" "mem"(memory 1))
  @@ -705,6 +727,13 @@ TEST(parser, export_kind_out_of_bounds)
  EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "Unexpected EOF");
  }
  +TEST(parser, export_invalid_utf8)
  +{
  + const auto section_contents = make_vec({bytes{0x03, 'a', 0x80, 'c', 0x00, 0x42}});
  + const auto wasm = bytes{wasm_prefix} + make_section(7, section_contents);
  + EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "Invalid UTF-8");
  +}
  +
  TEST(parser, export_name_out_of_bounds)
  {
  const auto wasm1 = bytes{wasm_prefix} + make_section(7, make_vec({"01"_bytes}));
  