zeroshade commented on code in PR #13381:
URL: https://github.com/apache/arrow/pull/13381#discussion_r897274054
##########
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:
is the `a.array.data.length > 0` actually needed? Also, shouldn't this be
`len(a.offsets) >= expNumOffsets` ?
`a.offsets[expNumOffsets-2]` would be incorrect, why the -2?
`a.offsets[expNumOffset]` should be the final byte.
--
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]