Skip to content

[Go] ValueOffset of array.Binary panics on last index #38458

@frbvianna

Description

@frbvianna

Describe the bug, including details regarding any error messages, version, and platform.

As detailed in #37976 (comment), we are using ValueOffset64 method of binary-like variable width types (string, binary) to calculate the offset differences and determine all individual value byte widths.

For an Arrow Record of e.g. 10 rows with an array.Binary field, a panic will occur on ValueOffset(10) (last index, matching the data slice length):

if i < 0 || i >= a.array.data.length {
panic("arrow/array: index out of range")
}

This seems to be due to use of >= instead of >. Apparently the same applies for array.LargeBinary fields.

For comparison, array.String fields do not panic when the index input matches the data length:

if i < 0 || i > a.array.data.length {
panic("arrow/array: index out of range")
}

Component(s)

Go

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions