diff options
author | Sam Clegg <sbc@chromium.org> | 2017-01-24 08:51:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 08:51:53 -0800 |
commit | f2f782dde1152057a4aed421ba89578c31ea66b6 (patch) | |
tree | 39d215fdfe466cef499d09c1621a982696f7a950 /src/binary-reader.c | |
parent | 88e6c3ca7d1bc55c475d8df0bdba3d1a70495104 (diff) | |
download | wabt-f2f782dde1152057a4aed421ba89578c31ea66b6.tar.gz wabt-f2f782dde1152057a4aed421ba89578c31ea66b6.tar.bz2 wabt-f2f782dde1152057a4aed421ba89578c31ea66b6.zip |
Fix reading of custom section relocations (#289)
The string name of the target section comes before
the relocation count.
This was not tested because we don't currently generate
any relocations for custom sections, so I also added
a binary/relocs.txt test to generate a binary that
does.
Diffstat (limited to 'src/binary-reader.c')
-rw-r--r-- | src/binary-reader.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/binary-reader.c b/src/binary-reader.c index ebb3b69f..896bb366 100644 --- a/src/binary-reader.c +++ b/src/binary-reader.c @@ -1712,10 +1712,10 @@ static void read_custom_section(Context* ctx, uint32_t section_size) { CALLBACK_SECTION(begin_reloc_section, section_size); uint32_t i, num_relocs, section; in_u32_leb128(ctx, §ion, "section"); - in_u32_leb128(ctx, &num_relocs, "relocation count count"); WASM_ZERO_MEMORY(section_name); if (section == WASM_BINARY_SECTION_CUSTOM) in_str(ctx, §ion_name, "section name"); + in_u32_leb128(ctx, &num_relocs, "relocation count"); CALLBACK(on_reloc_count, num_relocs, section, section_name); for (i = 0; i < num_relocs; ++i) { uint32_t reloc_type, offset; |