message: test: add test for limiting number of locals to 2^32
diff: @@ -144,6 +144,22 @@ TEST(parser, code_locals_invalid_type)
  EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "invalid valtype 123");
  }
  +TEST(parser, code_locals_too_many)
  +{
  + const auto large_num = "8080808008"_bytes; // 0x80000000
  + for (const auto& locals : {
  + make_vec({large_num + "7e"_bytes, large_num + "7e"_bytes}), // large i64 + large i64
  + make_vec({large_num + "7e"_bytes, large_num + "7f"_bytes}), // large i64 + large i32
  + make_vec({large_num + "7f"_bytes, large_num + "7f"_bytes}) // large i32 + large i32
  + })
  + {
  + const auto wasm =
  + bytes{wasm_prefix} + make_section(10, make_vec({add_size_prefix(locals + "0b"_bytes)}));
  +
  + EXPECT_THROW_MESSAGE(parse(wasm), parser_error, "too many local variables");
  + }
  +}
  +
  TEST(parser, module_empty)
  {
  const auto module = parse(wasm_prefix);
  