ngoldbaum opened a new pull request, #51158: URL: https://github.com/apache/arrow/pull/51158
### Rationale for this change `BaseBinaryBuilder::Append(std::string_view)`, `ExtendCurrent(std::string_view)` and `ChunkedBinaryBuilder::Append(std::string_view)` cast the value size to `int32_t` before validating it, so a value of 2 GiB or more is stored as an empty or truncated value. See #51156. ### What changes are included in this PR? The three overloads validate the 64-bit size before narrowing it, returning the same `CapacityError` that `ValidateOverflow` produces for the other paths. ### Are these changes tested? Yes, two `LARGE_MEMORY_TEST` cases in `array_binary_test.cc`. They fail without the fix. ### Are there any user-facing changes? `BinaryBuilder`, `StringBuilder` and `ChunkedBinaryBuilder` now return `CapacityError` for a `string_view` value of 2 GiB or more instead of storing wrong data. **This PR contains a "Critical Fix".** The builders produced incorrect data for such values. AI disclosure: I used an AI model to think about and iterate on the fix. It also originally identified the bug. * GitHub Issue: #51156 -- 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]
