CaptainAni187 opened a new pull request, #1353: URL: https://github.com/apache/arrow-go/pull/1353
### Rationale for this change Fixes #1344. `Value.Value()` built a long-form string with `unsafe.String(&v.value[5], sz)`. For an empty string the encoded value is only the 5-byte header and length, so `&v.value[5]` was out of range and it panicked. `String()` and `MarshalJSON()` go through `Value()` and panicked the same way. `validatePrimitiveValue` accepts the encoding, so `variant.New` returns the value without an error. ### What changes are included in this PR? The `PrimitiveString` branch now returns `""` when the length is zero, the same guard the short-string branch already has. ### Are these changes tested? Yes. `TestLongFormString` builds the 5-byte encoding from the issue and a non-empty long-form string, and checks `Type()`, `Value()` and `String()` for both. The empty case panics on main with `index out of range [5] with length 5` and passes with the fix. `go test ./parquet/...` passes (with the testing submodules), as do the other packages that import `parquet/variant` (`arrow/compute`, `arrow/extensions`, `parquet/pqarrow`). golangci-lint v2.13.2 reports no issues. ### Are there any user-facing changes? An empty string in the long-form encoding now reads as `""` instead of panicking. -- 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]
