From 8deeb5778fcdc6b457c5ae5a564530aa6c4d7100 Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Wed, 3 Dec 2025 20:18:32 +0800 Subject: [PATCH] fix: len --- common/bitutil/or_amd64.s | 2 +- common/bitutil/or_arm64.s | 2 +- common/bitutil/or_asm.go | 5 +++-- common/bitutil/or_generic.go | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/common/bitutil/or_amd64.s b/common/bitutil/or_amd64.s index 9c7cd12abb..d2d3b54fcf 100644 --- a/common/bitutil/or_amd64.s +++ b/common/bitutil/or_amd64.s @@ -1,4 +1,4 @@ -// Copyright 2018 The Go Authors. All rights reserved. +// Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // inspired by: https://github.com/golang/go/blob/4a3cef2036097d323b6cc0bbe90fc4d8c7588660/src/crypto/internal/fips140/subtle/xor_amd64.s diff --git a/common/bitutil/or_arm64.s b/common/bitutil/or_arm64.s index e6b49a48cc..15af58d314 100644 --- a/common/bitutil/or_arm64.s +++ b/common/bitutil/or_arm64.s @@ -1,4 +1,4 @@ -// Copyright 2020 The Go Authors. All rights reserved. +// Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // inspired by: https://github.com/golang/go/blob/4a3cef2036097d323b6cc0bbe90fc4d8c7588660/src/crypto/internal/fips140/subtle/xor_arm64.s diff --git a/common/bitutil/or_asm.go b/common/bitutil/or_asm.go index 6c6331e0e4..037ae0fb9c 100644 --- a/common/bitutil/or_asm.go +++ b/common/bitutil/or_asm.go @@ -1,4 +1,4 @@ -// Copyright 2018 The Go Authors. All rights reserved. +// Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // inspired by: https://github.com/golang/go/blob/4a3cef2036097d323b6cc0bbe90fc4d8c7588660/src/crypto/internal/fips140/subtle/xor_asm.go @@ -8,7 +8,8 @@ package bitutil func orBytes(dst, a, b []byte) int { - orBytesASM(&dst[0], &a[0], &b[0], len(a)) + n := min(len(a), len(b)) + orBytesASM(&dst[0], &a[0], &b[0], n) return len(a) } diff --git a/common/bitutil/or_generic.go b/common/bitutil/or_generic.go index 96f73a0273..e274b5b246 100644 --- a/common/bitutil/or_generic.go +++ b/common/bitutil/or_generic.go @@ -1,4 +1,4 @@ -// Copyright 2013 The Go Authors. All rights reserved. +// Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.