AynSiddiqui opened a new issue, #1568:
URL: https://github.com/apache/arrow-go/issues/1568
### Describe the bug, including details regarding any error messages,
version, and platform.
While working on #77 I ran the `arrow-testing/data/arrow-ipc-file` fuzz
inputs (public ClusterFuzz regressions) through `ipc.NewFileReader`. Three
distinct panics escape on main (`66722e30`, arrow-testing `6a7b02fa`, go1.27.1,
linux/amd64). Expected: `NewFileReader` returns an error for malformed input,
never panics.
Repro for all three (save as `repro.go` in an arrow-go checkout with the
`arrow-testing` submodule; run `go run repro.go
arrow-testing/data/arrow-ipc-file/<input>` from the repo root):
```go
package main
import ("bytes"; "fmt"; "os"; "github.com/apache/arrow-go/v18/arrow/ipc")
func main() {
for _, p := range os.Args[1:] {
func() {
defer func() { if r := recover(); r != nil {
fmt.Println(p, "panic:", r) } }()
b, _ := os.ReadFile(p)
_, err := ipc.NewFileReader(bytes.NewReader(b))
fmt.Println(p, "err:", err)
}()
}
}
```
**1. `panic: arrow: invalid union mode`** (input
`clusterfuzz-testcase-minimized-arrow-ipc-file-fuzz-5577412021190656`, 408 B;
also `...-5693640900083712`, `...-5864855240835072.fuzz`)
```
arrow.UnionOf arrow/datatype_nested.go:695
ipc.concreteTypeFromFB arrow/ipc/metadata.go:836
```
Cause: `concreteTypeFromFB` passes the flatbuffer's union mode straight to
`arrow.UnionOf`, which panics on anything but sparse/dense.
**2. `panic: arrow/ipc: invalid flatbuf.TimeUnit(35) value`**
(`clusterfuzz-testcase-minimized-arrow-ipc-file-fuzz-5749190446153728`, 378 B)
```
ipc.unitFromFB arrow/ipc/metadata.go:182
ipc.timeFromFB arrow/ipc/metadata.go:995
ipc.concreteTypeFromFB arrow/ipc/metadata.go:841
```
Cause: `unitFromFB` panics on an unknown time unit instead of returning an
error.
**3. `panic: runtime error: slice bounds out of range [196694:208]`**
(`clusterfuzz-testcase-minimized-arrow-ipc-file-fuzz-5768644156194816`, 2207 B;
also `clusterfuzz-testcase-arrow-ipc-file-fuzz-5768644156194816`)
```
flatbuf.(*BodyCompression).Codec
arrow/internal/flatbuf/BodyCompression.go:66
ipc.readDictionary arrow/ipc/file_reader.go:924
```
Cause: `readDictionary` reads `Compression().Codec()` from a table whose
offset is out of range, with no bounds check or recover on this path.
For comparison, all 84 `arrow-ipc-stream` fuzz inputs return an error or
read cleanly through `ipc.NewReader` (82 errors, 2 clean, 0 panics). Happy to
send PRs that return errors from these three paths, with the inputs as
regression tests.
### 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]