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

[NFC] Avoid huge output in validator messages #7334

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kripken
Copy link
Member

@kripken kripken commented Feb 27, 2025

Nested expressions that all fail to validate can lead to quadratic output
and OOMs. Instead, put a limit on the size we print, and after it only
emit truncated error messages of fixed size.

Also make some of the types more precise in this code, which makes
it easier to read.

Fixes #7333

@kripken kripken requested a review from tlively February 27, 2025 17:43
@kripken kripken changed the title [NFC] Avoiding huge output in validator messages [NFC] Avoid huge output in validator messages Feb 27, 2025
// already very large. This avoids quadratic output in some cases (e.g. if
// we have many nested expressions in each other, all of which fail to
// validate).
const std::ostringstream::pos_type MAX_OUTPUT = 100 * 1024;
Copy link
Member

Choose a reason for hiding this comment

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

Should this be lower? 100KB seems like much more than would actually be useful to look at.

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.

wasm-opt crashes with a bus error on a 91 kB Wasm file
2 participants