zeroshade commented on code in PR #35723:
URL: https://github.com/apache/arrow/pull/35723#discussion_r1210697021
##########
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:
nah, if we can't guarantee that it's a non-zero length then this is likely
fine as is.
--
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]