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:
parent
5f6b105c3e
commit
451f4c2a8f
1 changed files with 1 additions and 1 deletions
|
@ -61,7 +61,7 @@ func New() hash.Hash {
|
||||||
func (q *quickXorHash) Write(p []byte) (n int, err error) {
|
func (q *quickXorHash) Write(p []byte) (n int, err error) {
|
||||||
var i int
|
var i int
|
||||||
// fill last remain
|
// fill last remain
|
||||||
lastRemain := int(q.size) % dataSize
|
lastRemain := q.size % dataSize
|
||||||
if lastRemain != 0 {
|
if lastRemain != 0 {
|
||||||
i += xorBytes(q.data[lastRemain:], p)
|
i += xorBytes(q.data[lastRemain:], p)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue