Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Sep 30, 2024

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.
@@ -2722,16 +2726,18 @@ void WasmBinaryReader::readFunctions() {
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?

@kripken kripken merged commit fcd8dfe into WebAssembly:main Sep 30, 2024
13 checks passed
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