hcrosse opened a new pull request, #1514: URL: https://github.com/apache/arrow-go/pull/1514
### Rationale for this change `decimal128.FromString` and `decimal256.FromString` panic on infinities and huge exponents. Short strings representing huge or tiny values can allocate hundreds of megabytes, including in `Decimal32` and `Decimal64` at some scales. ### What changes are included in this PR? Parsing now rejects infinite parsed or scaled values and checks magnitude before converting to `big.Int`, including at negative scales in all four widths. It skips rounding when the scaled magnitude is below one quarter and already rounds to zero. Accepted values and range error messages are unchanged. ### Are these changes tested? `TestFromString` covers infinity and exponent panics in `decimal128` and `decimal256`, plus allocation limits for tiny values in all four widths. These cases panic or exceed the allocation limits on main. `TestBitLen` and boundary rows preserve existing range behavior. Some guards only limit memory use for huge values. Tests pass without them. I measured their memory use separately. With Go 1.26.10, `go test ./arrow/...` with `arrow-testing` and `parquet-testing` checked out, focused `-race -tags assert,test` runs, vet, lint and the Release Audit Tool passed. ### Are there any user-facing changes? Yes. Parsing avoids these panics and excessive allocations. There is no API change. Closes https://github.com/apache/arrow-go/issues/1512. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
