Merge pull request #1923 from guggero/base58-fix

base58: fix decoding issue
This commit is contained in:
Oliver Gugger 2022-11-18 22:39:47 +01:00 committed by GitHub
commit 02c854e943
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -55,6 +55,10 @@ func Decode(b string) []byte {
total := uint64(0)
for _, v := range t[:n] {
if v > 255 {
return []byte("")
}
tmp := b58[v]
if tmp == 255 {
return []byte("")

View File

@ -43,6 +43,8 @@ var invalidStringTests = []struct {
{"4kl8", ""},
{"0OIl", ""},
{"!@#$%^&*()-_=+~`", ""},
{"abcd\xd80", ""},
{"abcd\U000020BF", ""},
}
var hexTests = []struct {