coreos / torus

Torus Distributed Storage
https://coreos.com/blog/torus-distributed-storage-by-coreos.html
Apache License 2.0
1.78k stars 172 forks source link

nbd: use math.MatInt64 #349

Closed nak3 closed 8 years ago

nak3 commented 8 years ago
func (h *reqHeader) offset() int64 {
        const maxInt64 = (^uint64(0) >> 1) + 1
        if u := binary.BigEndian.Uint64(h[16:24]); u <= maxInt64 {
                return int64(u)
        }

This has a possibility of overflow int64(u). https://play.golang.org/p/neAeW9UC9c