summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm-binary.h2
-rw-r--r--src/wasm/wasm-binary.cpp13
2 files changed, 8 insertions, 7 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 9a79a4c8b..f7d57f5c9 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1453,7 +1453,7 @@ class WasmBinaryReader {
Index startIndex = -1;
std::set<Function::DebugLocation> debugLocation;
size_t codeSectionLocation;
- std::set<BinaryConsts::Section> seenSections;
+ std::unordered_set<uint8_t> seenSections;
// All types defined in the type section
std::vector<HeapType> types;
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index e08644eae..b05dd5237 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -1784,11 +1784,8 @@ void WasmBinaryReader::read() {
// note the section in the list of seen sections, as almost no sections can
// appear more than once, and verify those that shouldn't do not.
if (sectionCode != BinaryConsts::Section::Custom &&
- sectionCode != BinaryConsts::Section::Code) {
- if (!seenSections.insert(BinaryConsts::Section(sectionCode)).second) {
- throwError("section seen more than once: " +
- std::to_string(sectionCode));
- }
+ !seenSections.insert(sectionCode).second) {
+ throwError("section seen more than once: " + std::to_string(sectionCode));
}
switch (sectionCode) {
@@ -1837,7 +1834,7 @@ void WasmBinaryReader::read() {
case BinaryConsts::Section::Tag:
readTags();
break;
- default: {
+ case BinaryConsts::Section::Custom: {
readCustomSection(payloadLen);
if (pos > oldPos + payloadLen) {
throwError("bad user section size, started at " +
@@ -1846,7 +1843,11 @@ void WasmBinaryReader::read() {
" not being equal to new position " + std::to_string(pos));
}
pos = oldPos + payloadLen;
+ break;
}
+ default:
+ throwError(std::string("unrecognized section ID: ") +
+ std::to_string(sectionCode));
}
// make sure we advanced exactly past this section