summaryrefslogtreecommitdiff
path: root/src/binary-reader.c
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2017-01-24 08:51:53 -0800
committerGitHub <noreply@github.com>2017-01-24 08:51:53 -0800
commitf2f782dde1152057a4aed421ba89578c31ea66b6 (patch)
tree39d215fdfe466cef499d09c1621a982696f7a950 /src/binary-reader.c
parent88e6c3ca7d1bc55c475d8df0bdba3d1a70495104 (diff)
downloadwabt-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.c2
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, &section, "section");
- in_u32_leb128(ctx, &num_relocs, "relocation count count");
WASM_ZERO_MEMORY(section_name);
if (section == WASM_BINARY_SECTION_CUSTOM)
in_str(ctx, &section_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;