From 25011c50783b55cae85833f0e7c60f2726a25a1a Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Sat, 25 Sep 2021 19:53:20 -0700 Subject: [PATCH] src/internal/bytealg: fix indexing error in Compare() Fixes #2139 --- src/internal/bytealg/bytealg.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal/bytealg/bytealg.go b/src/internal/bytealg/bytealg.go index 0169fbbc..a6744c41 100644 --- a/src/internal/bytealg/bytealg.go +++ b/src/internal/bytealg/bytealg.go @@ -15,9 +15,9 @@ func Compare(a, b []byte) int { // Compare for differing bytes. for i := 0; i < len(a) && i < len(b); i++ { switch { - case a[0] < b[0]: + case a[i] < b[i]: return -1 - case a[0] > b[0]: + case a[i] > b[i]: return 1 } }