zeroshade commented on code in PR #13381:
URL: https://github.com/apache/arrow/pull/13381#discussion_r898022858
##########
go/arrow/array/string.go:
##########
@@ -113,6 +113,12 @@ func (a *String) setData(data *Data) {
if offsets := data.buffers[1]; offsets != nil {
a.offsets = arrow.Int32Traits.CastFromBytes(offsets.Bytes())
}
+
+ expNumOffsets := a.array.data.offset + a.array.data.length + 1
+ if a.array.data.length > 0 &&
+ (len(a.offsets) < expNumOffsets ||
int(a.offsets[expNumOffsets-2]) > len(a.values)) {
+ panic("arrow/array: string offsets out of bounds of data
buffer")
+ }
Review Comment:
I'd prefer the Concatenate error to still be an error if possible, but I'm
okay with it being a panic. That said, I don't want to rely on the
second-to-last offset, we should follow the Arrow spec and either rely on the
last offset or not add this check at all. Alternately we could follow the C++
path and add a Validate function to the arrays and then check that in the
reader so we can return an error.
Either way, I don't like relying on the second-to-last offset
--
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]