hcrosse opened a new issue, #1615:
URL: https://github.com/apache/arrow-go/issues/1615

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `String.ValidateFull` and `LargeString.ValidateFull` panic instead of 
returning an error when an intermediate offset exceeds the data buffer.
   
   I reproduced this on v18.9.0 and main, with Go 1.26.10 on macOS arm64.
   
   For a `String` array of length 2 built with `array.NewData` from raw buffers:
   
   ```go
   offsets := memory.NewBufferBytes(arrow.Int32Traits.CastToBytes([]int32{0, 
100, 5}))
   values := memory.NewBufferBytes([]byte("hello"))
   data := array.NewData(arrow.BinaryTypes.String, 2, []*memory.Buffer{nil, 
offsets, values}, nil, 0, 0)
   arr := array.NewStringData(data)
   
   fmt.Println(arr.Validate())
   arr.ValidateFull()
   ```
   
   ```text
   <nil>
   panic: runtime error: slice bounds out of range [:100] with length 5
   ```
   
   `LargeString` with the same offsets in an `int64` buffer has the same 
result, and `array.ValidateFull(arr)` panics the same way. `ValidateFull` 
should return an error instead of panicking.
   
   **Cause**
   
   `Validate` checks only the first and last offsets against the data length. 
`ValidateFull` checks monotonicity per slot, then slices the data for UTF8 
validation without checking that the current offset is within the buffer.
   
   
https://github.com/apache/arrow-go/blob/1cfb8bd743b391747702156d75b2b804ae22cab1/arrow/array/string.go#L216-L239
   
   
https://github.com/apache/arrow-go/blob/1cfb8bd743b391747702156d75b2b804ae22cab1/arrow/array/string.go#L434-L456
   
   ### Component(s)
   
   Other
   


-- 
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]

Reply via email to