kou commented on code in PR #47185:
URL: https://github.com/apache/arrow/pull/47185#discussion_r2229861486


##########
cpp/src/arrow/array/builder_binary.cc:
##########
@@ -162,7 +164,11 @@ void FixedSizeBinaryBuilder::Reset() {
 
 Status FixedSizeBinaryBuilder::Resize(int64_t capacity) {
   RETURN_NOT_OK(CheckCapacity(capacity));
-  RETURN_NOT_OK(byte_builder_.Resize(capacity * byte_width_));
+  int64_t dest_capacity_bytes;
+  if (ARROW_PREDICT_FALSE(MultiplyWithOverflow(capacity, byte_width_, 
&dest_capacity_bytes))) {
+    return Status::Invalid("Resize: capacity too large for byte width");

Review Comment:
   It may be better that we also show the requested capacity like 
https://github.com/apache/arrow/blob/25f8f008061b978137a2c1e5bc934d07fae56e3e/cpp/src/arrow/array/builder_base.h#L286-L294
 does.



-- 
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-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to