Fix BigInt exponentiation bypassing execution constraints#2350
Merged
Conversation
…os#2349) Validate estimated result size before calling BigInteger.Pow to prevent memory exhaustion from inputs like 11n**711111111n. Limits result to ~1 million bits (~125 KB), throwing RangeError for excessive sizes. Also fixes missing negative exponent check in **= assignment operator. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
lahma
enabled auto-merge (squash)
March 22, 2026 18:09
This was referenced Mar 23, 2026
8 tasks
This was referenced Jun 8, 2026
This was referenced Jun 29, 2026
This was referenced Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BigInteger.Powto prevent memory exhaustion from small inputs like11n**711111111nRangeError: Maximum BigInt size exceededfor excessive sizes**=assignment operatorFixes #2349
Test plan
**and**=operators)2n ** 100n)11n**711111111nnow throws immediately🤖 Generated with Claude Code