hcrosse opened a new pull request, #1648: URL: https://github.com/apache/arrow-go/pull/1648
### Rationale for this change `ListBuilder` and `ListViewBuilder` narrow child lengths, offsets and sizes to `int32` without checking bounds, so values above `math.MaxInt32` wrap to negative numbers and produce invalid arrays. In `arrow/scalar`, `AppendSlice` reserves and mutates list builders without checking whether the combined child length exceeds the builder offset limit. ### What changes are included in this PR? `ListBuilder` now checks offsets against `math.MaxInt32` before changing lengths or validity in `Append`, `AppendNull`, `AppendNulls` and `AppendEmptyValues`. `ListViewBuilder` now checks offsets, sizes and their sum against `math.MaxInt32` in `AppendWithSize`, `AppendDimensions`, `AppendNulls`, `AppendEmptyValues` and `UnmarshalOne`. Both builders panic before writing wrapped `int32` values. In `arrow/scalar`, `AppendSlice` checks existing child length and incoming list lengths against `math.MaxInt32` for `ListBuilder`, `ListViewBuilder` and `MapBuilder` and against `math.MaxInt` for large list builders, returning `arrow.ErrInvalid` before reserving child storage or appending values. ### Are these changes tested? Yes. I added unit tests covering `ListBuilder` and `ListViewBuilder` overflow panics, unmutated builder state after rejected bulk appends, and `arrow.ErrInvalid` returns from `scalar.AppendSlice` for list, list view and map builders. ### Are there any user-facing changes? Yes. List builders panic instead of writing wrapped `int32` offsets or sizes, and `scalar.AppendSlice` returns `arrow.ErrInvalid` on overflow. There is no API change. -- 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]
