diff options
author | Sam Clegg <sbc@chromium.org> | 2017-03-31 15:59:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-31 15:59:09 -0700 |
commit | f57ff31c1425e5f066dd0959992fb2aabc39b510 (patch) | |
tree | 1a8b8356816ff96ebf3e9aba8867e0ac71f3b68e /src/binary-reader.cc | |
parent | feb6ee594bf670d5c637e8b11e598af2dc37f95d (diff) | |
download | wabt-f57ff31c1425e5f066dd0959992fb2aabc39b510.tar.gz wabt-f57ff31c1425e5f066dd0959992fb2aabc39b510.tar.bz2 wabt-f57ff31c1425e5f066dd0959992fb2aabc39b510.zip |
Allow names section to be sparse (#381)
Only emit names for function that actually have one.
Previously we were emitting empty strings for functions
without names. The new version of the names section
allow for a sparse list.
Also, cleanup the function name handling in wasm-link.
Diffstat (limited to 'src/binary-reader.cc')
-rw-r--r-- | src/binary-reader.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/binary-reader.cc b/src/binary-reader.cc index 4ac9c746..136b4c4a 100644 --- a/src/binary-reader.cc +++ b/src/binary-reader.cc @@ -943,6 +943,8 @@ static void read_custom_section(Context* ctx, uint32_t section_size) { StringSlice function_name; in_u32_leb128(ctx, &function_index, "function index"); + RAISE_ERROR_UNLESS(function_index < num_total_funcs(ctx), + "invalid function index: %u", function_index); in_str(ctx, &function_name, "function name"); CALLBACK(OnFunctionName, function_index, function_name); } |