chriscasola commented on code in PR #35723:
URL: https://github.com/apache/arrow/pull/35723#discussion_r1210676066
##########
go/arrow/bitutil/bitutil.go:
##########
@@ -150,15 +150,12 @@ const (
)
func bytesToUint64(b []byte) []uint64 {
- h := (*reflect.SliceHeader)(unsafe.Pointer(&b))
-
- var res []uint64
- s := (*reflect.SliceHeader)(unsafe.Pointer(&res))
- s.Data = h.Data
- s.Len = h.Len / uint64SizeBytes
- s.Cap = h.Cap / uint64SizeBytes
+ if cap(b) < uint64SizeBytes {
+ return nil
+ }
- return res
+ h := (*reflect.SliceHeader)(unsafe.Pointer(&b))
+ return unsafe.Slice((*uint64)(unsafe.Pointer(h.Data)),
cap(b)/uint64SizeBytes)[:len(b)/uint64SizeBytes]
Review Comment:
I'm not sure I can guarantee that. Are you suggesting we add a check just
above and `return nil` if the length is `< 1`?
--
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]