fix(calcite): gate checkOverflow toPlainString with isBoundedDecimal - #5223
Open
shoemoney wants to merge 1 commit into
Open
fix(calcite): gate checkOverflow toPlainString with isBoundedDecimal#5223shoemoney wants to merge 1 commit into
shoemoney wants to merge 1 commit into
Conversation
Fix verified RED->GREEN. Primitive.checkOverflow unbounded toPlainString sibling of CALCITE-7731 at Primitive.java:420
Contributor
|
The linter won't like your commit message. Have you tried to validate this locally? |
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.
Sibling of CALCITE-7731.
Bug: Primitive.checkOverflow calls BigDecimal.toPlainString on a value with scale < 0 without bounding the plain-notation expansion. A large negative scale can force toPlainString to materialize gigabytes and OOM, same pattern bounded elsewhere in CALCITE-7731.
Fix: Gate the toPlainString call with isBoundedDecimal. This mirrors SqlUtil.isBoundedDecimal in core but is inlined in linq4j to avoid a circular linq4j -> core dependency. The bound reads calcite.parser.maxDecimalLiteralPlainDigits (default 10000) and checks precision + abs(scale) <= limit. If exceeded, throw IllegalArgumentException before allocation.
Evidence: RED->GREEN verified. Both :linq4j:compileJava configurations succeed. Formatter blast radius is one file.