zeroshade commented on code in PR #1219:
URL: https://github.com/apache/arrow-go/pull/1219#discussion_r3896881529
##########
arrow/array/concat.go:
##########
@@ -866,21 +866,32 @@ func updateRuns[T int16 | int32 | int64](inputData
[]arrow.ArrayData, inputBuffe
continue
}
src := arrow.GetData[T](buf.Bytes())
+ offset := inputData[i].Offset()
+
+ // A slice can end in the middle of a run, leaving this input's
final physical
+ // run end past its logical length. Clamp the normalized final
run end to the
+ // input's logical length before both the overflow check and
the output write:
+ // otherwise a valid near-limit slice trips a false overflow,
and the written
+ // run end overshoots (shifting every following array's run
ends).
+ finalEnd := int(src[len(src)-1]) - offset
Review Comment:
Converting the final `int64` run end to `int` overflows on 32-bit targets. A
valid run-end encoded array with final run end `math.MaxInt64` and logical
length 1 becomes `-1` during concatenation, producing invalid output. Please
keep this calculation in type `T`, clamp against `T(inputData[i].Len())`, and
add a 32-bit `int64` regression test.
--
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]