1fanwang commented on code in PR #51169:
URL: https://github.com/apache/arrow/pull/51169#discussion_r3953564408


##########
cpp/src/arrow/util/decimal.cc:
##########
@@ -962,9 +985,9 @@ Status SimpleDecimalFromString(const char* type_name, 
std::string_view s,
 
   if (out != nullptr) {
     uint64_t value{0};
-    ShiftAndAdd(dec.whole_digits, &value, 1);
-    ShiftAndAdd(dec.fractional_digits, &value, 1);
-    if (value > static_cast<uint64_t>(
+    if (ShiftAndAddWithOverflow(dec.whole_digits, &value, 1) ||
+        ShiftAndAddWithOverflow(dec.fractional_digits, &value, 1) ||
+        value > static_cast<uint64_t>(
                     std::numeric_limits<typename 
DecimalClass::ValueType>::max())) {
       return Status::Invalid("The string '", s, "' cannot be represented as ", 
type_name);

Review Comment:
   Done in 
[aa6fc1e](https://github.com/apache/arrow/commit/aa6fc1e361b3c618e8f2ed275ee9ad47b341ad19).



-- 
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]

Reply via email to