Skip to content

Limit inferred type sizes #2382

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

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

Limit inferred type sizes #2382

wants to merge 3 commits into from

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented May 8, 2025

This change introduces a notion of type "size" as a way to detect and avoid degenerate type inference cases. The examples found by the fuzzer can create large, complex types that result in hangs during type inference. Much like the type inference recursion limit, this size limit is a heuristic that is unlikely to be hit during normal use of the language but prevents crashes or hangs during extreme usage such as with generated code that incurs artificially large or deeply nested types.
Fixes #2369

This change introduces a notion of type "size" as a way to detect and avoid degenerate type inference cases. The examples found by the fuzzer can create large, complex types that result in hangs during type inference. Much like the type inference recursion limit, this size limit is a heuristic that is unlikely to be hit during normal use of the language but prevents crashes or hangs during extreme usage such as with generated code that incurs artificially large or deeply nested types.
Fixes #2369
@swernli swernli requested review from idavis and minestarks as code owners May 8, 2025 06:25
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.

Fuzz: "==4635== ERROR: libFuzzer: timeout after 1265 seconds" (ubuntu-latest)
2 participants