onedrive: fix quickxorhash on 32 bit architectures

Before this fix quickxorhash would sometimes crash with an error like
this:

    panic: runtime error: slice bounds out of range [-1248:]

This was caused by an incorrect cast of a 64 bit number to a 32 bit
one on 32 bit platforms.

See: https://forum.rclone.org/t/panic-runtime-error-slice-bounds-out-of-range/37548
This commit is contained in:
Nick Craig-Wood 2023-04-13 11:14:10 +01:00
parent 5f6b105c3e
commit 451f4c2a8f

View File

@ -61,7 +61,7 @@ func New() hash.Hash {
func (q *quickXorHash) Write(p []byte) (n int, err error) {
var i int
// fill last remain
lastRemain := int(q.size) % dataSize
lastRemain := q.size % dataSize
if lastRemain != 0 {
i += xorBytes(q.data[lastRemain:], p)
}