You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "metsw24-max (via GitHub)" <gi...@apache.org> on 2026/05/27 16:50:13 UTC
[I] [C++] Signed integer overflow in Decimal FromString exponent handling [arrow]
metsw24-max opened a new issue, #50057:
URL: https://github.com/apache/arrow/issues/50057
`Decimal{32,64,128,256}::FromString` parse the exponent with `ParseValue<Int32Type>`, so it can be any `int32_t` including `INT32_MIN`. `DecimalFromString`/`SimpleDecimalFromString` in `cpp/src/arrow/util/decimal.cc` then compute `parsed_scale = -adjusted_exponent + fractional_digits`. For an input like `0E-2147483648` the negation of `INT32_MIN` is signed-integer-overflow UB; a near-`INT32_MIN` exponent overflows the addition.
UBSan on the expression:
```
decimal.cc: runtime error: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int')
```
These are public string-parsing entry points reachable from the CSV/JSON readers when converting decimal columns, so the input crosses a trust boundary.
--
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: issues-unsubscribe@arrow.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [C++] Signed integer overflow in Decimal FromString exponent handling [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou closed issue #50057: [C++] Signed integer overflow in Decimal FromString exponent handling
URL: https://github.com/apache/arrow/issues/50057
--
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: issues-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [C++] Signed integer overflow in Decimal FromString exponent handling [arrow]
Posted by "omertt27 (via GitHub)" <gi...@apache.org>.
omertt27 commented on issue #50057:
URL: https://github.com/apache/arrow/issues/50057#issuecomment-4662039373
Hello metsw, I want to work on this issue. I will reproduce the UBSan failure related to INT32_MIN exponent handling in DecimalFromString and will investigate the fix of issue.
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [C++] Signed integer overflow in Decimal FromString exponent handling [arrow]
Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on issue #50057:
URL: https://github.com/apache/arrow/issues/50057#issuecomment-4797464464
Issue resolved by pull request 50058
https://github.com/apache/arrow/pull/50058
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org