diff options
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 0b07be802..f1ccb2cfa 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1072,6 +1072,12 @@ void FunctionValidator::visitFunction(Function* curr) { if (curr->imported()) { shouldBeTrue(curr->type.is(), curr->name, "imported functions must have a function type"); } + // validate optional local names + std::set<Name> seen; + for (auto& pair : curr->localNames) { + Name name = pair.second; + shouldBeTrue(seen.insert(name).second, name, "local names must be unique"); + } } static bool checkOffset(Expression* curr, Address add, Address max) { |