summaryrefslogtreecommitdiff
path: root/src/binary-reader.cc
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2020-07-31 19:29:30 +0200
committerGitHub <noreply@github.com>2020-07-31 10:29:30 -0700
commit347bef5355bfdf220a27adce82516c7e706b3b1f (patch)
tree53ea29ce7a7eec35569ae707b0d0f3f4350b6678 /src/binary-reader.cc
parent724b83c95368ee389eca9df6f47aa7e971dd03a0 (diff)
downloadwabt-347bef5355bfdf220a27adce82516c7e706b3b1f.tar.gz
wabt-347bef5355bfdf220a27adce82516c7e706b3b1f.tar.bz2
wabt-347bef5355bfdf220a27adce82516c7e706b3b1f.zip
Fix reading of section code (#1501)
The section code is just a single byte, not a LEB128-encoded value. With this fix the section code is now read correctly with ReadU8().
Diffstat (limited to 'src/binary-reader.cc')
-rw-r--r--src/binary-reader.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/binary-reader.cc b/src/binary-reader.cc
index 217253f5..c410aca9 100644
--- a/src/binary-reader.cc
+++ b/src/binary-reader.cc
@@ -2360,9 +2360,9 @@ Result BinaryReader::ReadSections() {
bool seen_section_code[static_cast<int>(BinarySection::Last) + 1] = {false};
for (; state_.offset < state_.size; ++section_index) {
- uint32_t section_code;
+ uint8_t section_code;
Offset section_size;
- CHECK_RESULT(ReadU32Leb128(&section_code, "section code"));
+ CHECK_RESULT(ReadU8(&section_code, "section code"));
CHECK_RESULT(ReadOffset(&section_size, "section size"));
ReadEndRestoreGuard guard(this);
read_end_ = state_.offset + section_size;