Skip to content

Comments

Binary parser: lift the limit on the number of locals#6973

Merged
kripken merged 3 commits intoWebAssembly:mainfrom
vouillon:locals-limit
Sep 30, 2024
Merged

Binary parser: lift the limit on the number of locals#6973
kripken merged 3 commits intoWebAssembly:mainfrom
vouillon:locals-limit

Conversation

@vouillon
Copy link
Contributor

This raises the number of locals accepted by the binary parser to the absolute limit in the spec. A warning is now printed when writing a binary file if the Web limit of 50,000 locals is exceeded. This fixes #6968.

This raises the number of locals accepted by the binary parser to the
absolute limit in the spec. A warning is now printed when writing a
binary file if the Web limit of 50,000 locals is exceeded. This fixes WebAssembly#6968.
void WasmBinaryReader::readVars() {
uint32_t totalVars = 0;
size_t numLocalTypes = getU32LEB();
std::vector<std::pair<uint32_t, Type>> decodedVars;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::vector<std::pair<uint32_t, Type>> decodedVars;
// Use a SmallVector as in the common (MVP) case there are only 4 possible types.
SmallVector<std::pair<uint32_t, Type>, 4> decodedVars;

@kripken
Copy link
Member

kripken commented Sep 26, 2024

Looks good aside from one suggestion. Also, I think we can test this in test/unit/test_web_limitations.py?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raising the limit on the number of locals in input files

2 participants